Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Use this tag for questions about Ansible, an open-source automation engine, related to using Ansible for topics such as cloud provisioning, configuration management, application deployment, etc.
4
votes
Accepted
How to ensure that removed allowed ports will be removed using Ansible's UFW module?
Either use delete=yes
# or a separate state=reset task)
The following snippet was added to the top of the file:
---
- name: Reset UFW
ufw:
state: reset
Once ansible was run:
TASK [rolename …
1
vote
Playbook without relative path to vars
To avoid such issues, that is why there are Hosts and Groups in Ansible. … /etc/ansible/group_vars/raleigh # can optionally end in '.yml', '.yaml', or '.json'
/etc/ansible/group_vars/webservers
/etc/ansible/host_vars/foosball …
2
votes
Running Ansible no-op's faster with a dynamic inventory and cached facts files
Instead of storing the Ansible code centrally, one could extract the code and distribute it to every project. …
2
votes
Discovering extra args needed for running ansible playbooks
This means
the role will bring along a default value but ANYTHING in Ansible will
override it. It’s just a default. … There is a number of galaxy playbooks that could be checked:
https://github.com/geerlingguy/ansible-role-nginx
https://github.com/shelleg/ansible-role-gradle
https://galaxy.ansible.com/030/firefox/ …
2
votes
Change Ansible module based on variable or group
It is possible to declare group and host vars http://docs.ansible.com/ansible/latest/playbooks_best_practices.html
group_vars/
group1 # here we assign variables to particular groups …
1
vote
Accepted
ansible question to execute and display multiple commands
One could use -vvv to get the output of the commands while running the playbook:
changed: [localhost] => (item=echo helloworld) => {
"ansible_loop_var": "item",
"changed": true,
"cmd": …
1
vote
Deploying VMs using roles and hosts in Ansible based on operating system
https://github.com/030/ansible-certbot
main.yml
- include: Debian.yml
when: ansible_os_family == 'Debian'
put everything that is required on debian like apt in Debian.yml and yum in Centos.yml. … This is a more comprehensive example https://github.com/geerlingguy/ansible-role-mysql/blob/master/tasks/main.yml …
2
votes
How to run Ansible with sudo no password commands with become syntax
Did you try -K already? I always use this option and then a sudo password has to be entered
1
vote
Conditionally run certbot
One could use the apt module of Ansible. http://docs.ansible.com/ansible/latest/apt_module.html
The apt module uses apt and apt itself is able to check whether a package has already been installed and … https://github.com/030/ansible-certbot/blob/master/tasks/Debian.yml#L10
- name: certbot installed
apt:
name: certbot
state: latest …
2
votes
How do I run Ansible Azure playbooks while avoiding storing credentials in files?
Please read https://docs.ansible.com/ansible/2.4/vault.html
Since Ansible 2.4 one could use --vault-id @prompt. … Encrypt a file using ansible-vault:
ansible-vault encrypt /path/to/encrypted/file
Run the playbook and it will result in:
fatal: [localhost]: FAILED! …
1
vote
ansible AWX is connecting through ssh as root instead of user defined in credential
According to https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html
it should be remote_user: if it still does not work, run the playbook with -vvvv and add the log to the Q&A. …
7
votes
Accepted
Is it possible to combine jinja templates in ansible like this is possible with erbs in puppet?
Yes, that is possible according to this post.
When a second jinja template was created and this was included in the base jinja it was called.
{% include "checks/subdue.j2" %}
4
votes
Is there an ansible module that check whether a port is not in LISTEN state?
[WARNING]: Could not create retry file
'/etc/ansible/roles/role_under_test/tests/test.retry'. [Errno 30] Read-
only file system: u'/etc/ansible/roles/role_under_test/tests/test.retry' …
3
votes
Three solutions to structure a deployment with Ansible?
I would recommend to structure the code as defined in the Ansible Best Practices document:
and to follow the structure that major contributors to the ansible galaxy platform use, like geerlingguy. … If one will follow a significant different structure then it will be really hard in the future to reuse roles from the ansible galaxy community and one has to reinvent the wheel. …
2
votes
Accepted
What are best practices of deploying docker-compose using Ansible?
Instead of using a symlink that will be stored as is in BitBucket one could use:
- name: Copy docker-compose.yml
copy:
src: ../../../../docker-compose.yml
dest: /path/to/docker-compose.yml
…