linux_wiki:ansible-pull

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

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.
-<code bash>+<code yaml>
 # File: myplaybook.yml # File: myplaybook.yml
 # Description: Playbook used to execute on the local system via ansible-pull # Description: Playbook used to execute on the local system via ansible-pull
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.
-<code bash></code>+ 
 +\\ 
 +File: myrole/tasks/main.yml  -> Installs a list of applications using the variable "my_awesome_apps" and notifies a handler if anything changes 
 +<code yaml> 
 +- name: Install my awesome app list 
 +  yum: 
 +    name: "{{ my_awesome_apps }}" 
 +    state: present 
 +  notify: restart my awesome service 
 +</code> 
 + 
 +\\ 
 +File: myrole/vars/main.yml  -> Variable that contains a list of applications to install 
 +<code yaml> 
 +my_awesome_apps: 
 + - myapp1 
 + - myapp2 
 +</code> 
 + 
 +\\ 
 +File: myrole/vars/handlers.yml  -> Handler that restarts a service when triggered 
 +<code yaml> 
 +- name: restart my awesome service 
 +  service: 
 +    name: my-awesome-service 
 +    state: restarted 
 +</code>
  
 ---- ----
Line 98: Line 124:
   * --clean  -> Files modified in the local copy of the repo are discarded   * --clean  -> Files modified in the local copy of the repo are discarded
   * myplaybook.yml  -> Playbook to execute in the repo   * myplaybook.yml  -> Playbook to execute in the repo
 +
 +----
 +
 +====== Beyond: Continuous Deployment ======
 +
 +Using ansible-pull, there is now the capability to make changes to systems via repo pushes.
 +
 +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<code bash>--only-if-changed</code>
 +
 +  * Create a branch for each type of environment systems are in. 
 +    * Examples:
 +      * Unstable
 +      * Development
 +      * Testing
 +      * Production
 +    * Add protection to Development, Testing, and Production to force merge requests (peer review) prior to updates being pushed.
 +    * 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<code bash>--checkout 'development'</code>
  
 ---- ----
  
  • linux_wiki/ansible-pull.1532145816.txt.gz
  • Last modified: 2019/05/25 23:50
  • (external edit)