Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
linux_wiki:ansible-pull [2018/07/21 00:03] billdozor [Playbook: Example] |
linux_wiki:ansible-pull [2019/05/25 23:50] (current) |
||
---|---|---|---|
Line 49: | Line 49: | ||
Example of a playbook tailored for pulling. | Example of a playbook tailored for pulling. | ||
- | < | + | < |
# File: myplaybook.yml | # File: myplaybook.yml | ||
# Description: | # Description: | ||
Line 69: | Line 69: | ||
Example of a role that can be used with either a pull playbook or normal playbook. | Example of a role that can be used with either a pull playbook or normal playbook. | ||
- | < | + | |
+ | \\ | ||
+ | File: myrole/ | ||
+ | <code yaml> | ||
+ | - name: Install my awesome app list | ||
+ | yum: | ||
+ | name: "{{ my_awesome_apps }}" | ||
+ | state: present | ||
+ | notify: restart my awesome service | ||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | File: myrole/ | ||
+ | <code yaml> | ||
+ | my_awesome_apps: | ||
+ | - myapp1 | ||
+ | - myapp2 | ||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | File: myrole/ | ||
+ | < | ||
+ | - name: restart my awesome service | ||
+ | service: | ||
+ | name: my-awesome-service | ||
+ | state: restarted | ||
+ | </ | ||
---- | ---- | ||
Line 98: | Line 124: | ||
* --clean | * --clean | ||
* myplaybook.yml | * myplaybook.yml | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ====== Beyond: Continuous Deployment ====== | ||
+ | |||
+ | Using ansible-pull, | ||
+ | |||
+ | Automation Ideas | ||
+ | * Create a cron that runs an ansible-pull script | ||
+ | * The script could provide logging for ansible-pull command output | ||
+ | * Have the cron run frequently enough to pick up changes fast (every 15 minutes or so) | ||
+ | |||
+ | * Add an argument to the ansible-pull command to only execute if the remote repo has been updated< | ||
+ | |||
+ | * Create a branch for each type of environment systems are in. | ||
+ | * Examples: | ||
+ | * Unstable | ||
+ | * Development | ||
+ | * Testing | ||
+ | * Production | ||
+ | * Add protection to Development, | ||
+ | * Use Unstable to test changes to a small group of systems | ||
+ | |||
+ | * Add an argument to the ansible-pull command to include the branch name for each environment. Development branch example< | ||
---- | ---- | ||