Last active
September 2, 2016 15:40
-
-
Save samdoran/96c644030a614c6104ad7c390039aeb5 to your computer and use it in GitHub Desktop.
pasteboard
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: Playbook | |
hosts: all | |
roles: | |
- role: sshd | |
when: | |
- ansible_os_family == 'RedHat' | |
- ansible_distribution_version | version_compare('6', '>=') |
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
# Patch files from command line | |
$ cd ~/ansible-playbooks/playbooks/ | |
$ ansible-playbook -i ~/temp_patches patch_things.yml -e 'target_hosts=all' | |
# Load ad-hoc inventory patches into Ansible Tower | |
$ tower-manage inventory_import --source patch_hosts --inventory-name Patches --overwrite --overwrite-vars | |
=========== | |
# Playbook | |
- name: Patch all the things | |
hosts: "{{ target_hosts | default('all') }}" | |
roles: | |
- sshd | |
- changerootpw |
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: localhost | |
remote_user: root | |
roles: | |
- role-elasticsearch-curator |
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
--- | |
image: "samdoran/gitlab-ci-test-el6" | |
before_script: | |
- ansible --version | |
- printf '[defaults]\nroles_path=../' > ansible.cfg | |
test: | |
script: | |
# Basic role syntax check | |
- ansible-playbook tests/gitlab-ci-test.yml -i tests/inventory --syntax-check | |
# Run the first time | |
- ansible-playbook tests/gitlab-ci-test.yml -i tests/inventory -c local -b | |
# Run again and expect no changes | |
- > | |
ansible-playbook tests/gitlab-ci-test.yml -i tests/inventory -c local -b | |
| grep -q 'changed=0.*failed=0' | |
&& (echo 'Idempotence test: pass' && exit 0) | |
|| (echo 'Idempotence test: fail' && exit 1) |
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
- src: git@git.acme.com:ansible/role-gitlab.git | |
name: gitlab | |
scm: git |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment