Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

New answers tagged


Enabling action plugins You can enable a custom action plugin by either dropping it into the action_plugins directory adjacent to your play, inside a role, or by putting it in one of the action plugin directory sources configured in ansible.cfg. Using action plugins Action plugin are executed by default when an associated module is used; no action is ...


Several problems in your playbook. loop is basically expecting a list, not a string containing a variable name. You need to expand your variable with a jinja2 expression => `loop: "{{ some_list_variable }}" It will be hard to give you the correct syntax without seeing the exact data structure of your result var but... Typically, the register from a loop ...


To replace all lines in the file replace module is needed. This is the equivalent (backup differs). tasks: - lineinfile: path: myconffile backup: yes state: absent regexp: '\(ADDRESS = \(PROTOCOL = TCP\)\(HOST =\)\(PORT = 1501\)\)' - replace: path: myconffile backup: yes regexp: '\(...


Since Ansible was installed via Homebrew on macOS, the workaround is to install Ansible using Pip. $ brew remove ansible $ pip3 install ansible $ pip3 list | grep -e ansible -e Jinja2 ansible 2.8.0 Jinja2 2.8 $ ansible-playbook check_jinja.yaml -v TASK [jinja_version] ok: [localhost] => {"changed": false, "msg": "2.8"}


become_user will tell which user to become to run a particular ansible module on the remote server. If you want to run the ansible command on your control machine as an other user, you need to use sudo or su on this machine e.g. sudo -s -u ansible ansible all -m ping The -s option will load the user's shell an make sure homedir and all other envs are ...


The thing that makes this complicated is that ansible registers variables and facts locally, on the target remote host - and then has a different set of variables and facts once it moves to the next host. So it would require a bit of fiddling to do this exactly the way you want. One way to approach this would be to just use run_once, but it doesn't work ...


If you're able to connect to the host $ ssh ansible@<host> then try ansible <hosts> -u ansible -m ping


How to formulate the code to get rid of [DEPRECATION WARNING] during runtime? Simply by following the tip in the error message. when: CURRENT_INSTALLED_VERSION.stdout is version(EXPECTED_REMOTE_SOFTWARE_VERSION,'>=') Is there are better way to apply the same logic? I don't see anything wrong if it meets your current needs. Only remark: The first ...

Top 50 recent answers are included