This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example Playbook for ACLs | |
--- | |
- hosts: all | |
connection: local | |
vars: | |
force: "false" | |
vars_prompt: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tasks: | |
- name: install prerequisite packages | |
apt: | |
update_cache: yes | |
name: "{{ item }}" | |
install_recommends: no | |
state: latest | |
with_items: | |
- nginx | |
- python-pip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: all | |
remote_user: root | |
tasks: | |
- name: Say bar | |
shell: echo "bar" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# this play queries all servers and creates groups | |
- hosts: all | |
remote_user: root | |
# remote_user: someuser | |
# sudo: true | |
tasks: | |
- name: create dynamic groups based on OS | |
group_by: key=ansible_os_family |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: web | |
serial: 1 | |
tasks: | |
- include: includes/{{ inventory_class }}_web_update.yml | |
- hosts: core | |
serial: 1 | |
tasks: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- command: grep string file | |
ignore_errors: yes | |
register: result | |
# How to set this fact so that it is a boolean variable, not a string? | |
- set_fact: | |
got_string: "{{ (result|success)|bool }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Ensure git is installed (Debian). | |
apt: name={{ item }} state=installed | |
with_items: git_packages | |
# Install git from source when git_install_from_source is true. | |
- include: install-from-source.yml | |
when: git_install_from_source == true |