Ansible pass value to installation commandline gui - ansible

How do I pass value to the commandline-gui prompt?
Like I typically install LAMP on a fresh Ubuntu using the following command.
sudo apt-get install lamp-server^ phpmyadmin
And during install I am asked for a few inputs as below
So how do I pass/input values from a playbook?

When using Ansible, you would generally install the packages non-interactively, like this [1]:
- command: apt-get -y install lamp-server^ phpmyadmin
environment:
DEBIAN_FRONTEND: noninteractive
This will suppress any interactive configuration prompts during the
install. You can then perform configuration tasks after the fact using
Ansible, either by directly manipulating files etc. or by using the
debconf module.
If you're not familiar with debconf, this question has some information about interacting with the package configuration system.
[1] Actually, you would more often use the package module, but that doesn't support package groups like lamp-server^.

Related

How can I check for daily updates for Ubuntu 16.04 via command line?

I do not know how to check for this via command line. I do know that you can do this for through the GUI; however, I want to implement this in my script. Anyone know how to do this? (I haven't found anything about this).
Ubuntu updates are managed through the apt package manager.
If you're looking to run daily updates you'll want to do something like:
sudo apt update # updates apt packages index
sudo apt upgrade # runs upgrades on all packages

Ansible insatllation through brew and pip in mac

What is the difference between brew installation and pip installation in mac
Is there any supporting packages ?
Please give me some good ways to install ansible
brew install ansible
I prefer a installation via brew. I see the following pro's:
integration better geared towards mac (pip is more general purpose)
I try to install everything via brew (not pip for python, npm for javasscript...)
upgrade mechanism seems better to me (as far as I know upgrading every pip package is a bit hacky)
The ansible documentation recommends installation via pip :
https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#control-node-requirements
I trust the product documentation more than the hearsay. Arguments like "I try to install everything via brew" do not apply here.
I recommend using pip as well, with a good python versions management and virtual environment.
I am using myself a combination of pyenv + venv (the latter is a module in recent versions of python in the standard library) and run Ansible on a control node in Mac OS in a python virtual env. It gives full control and definitely is not "hacky". The brew way is relying on system python on the other hand puts ansible in a Cellar site packages, ties it to a particular version of python with all its consequences and surprises.
To the OP - please read the ansible user guide and getting started documentation first before asking "please give me one sample".

ansible module actions without install

I'm writing an Ansible playbook to configure new machines for our developing environment.
If I want to install postgresql using homebrew, I would use Ansible's given homebrew model to achieve this task.
But before I run this task, should I have a task that will install homebrew first?
If this is the case, how can I install homebrew using the command or shell Ansible module, which will normally prompt for a user input during the process of installation?
Yes, you have to install Homebrew first. The homebrew Ansible module documentation is not clear about that; if you check its source code it fails if it can’t find Homebrew and it doesn’t try to install it for you.
There already are answers on how to bypass the prompt in Homebrew’s install script. There are also other ways of installing Homebrew like downloading it as a tarball and un-taring it somewhere (which you can do with the unarchive Ansible module) or cloning its source code using git.

How to create lxc containers in ubuntu 14.04 using Ansible module?

I am trying to create a lxc container by using lxc_container module provided by ansible. Can someone tell me the exact playbook task which will just create the lxc container ?
Based on the response in the comments above and your duplicate question.
It would appear that your issue is caused by not having the module lxc-python2 installed.
I'm also assuming there's other errors which your are overlooking in your posts and debugging efforts. So the steps to apply are as follows:
sudo apt-get install python-pip
pip install lxc-python2
read any error output carefully.

Testing installation script on Linux

I'm writing a Bash script that sets up a Drupal development environment for people using Ubuntu. To test this out I've installed a fresh copy of Ubuntu in VirtualBox and am constantly using the snapshot feature to get back my fresh install after every run of the script.
Currently however my script is re-downloading all the packages that need to be installed every time I run the script. Is there a way I can get apt-get to install these packages from local storage?
Perhaps downloading them, but not installing them at once. Taking a snapshot then, and then usage of apt-get that will use the local packages that were downloaded.
How would I go about doing this? Is there perhaps some apt-get magic that will do the trick?
apt-get --download-only install should do the trick.
Then make the snapshot, then run apt-get install again without --download-only.

Resources