ansible playbook execute in this order: task, role, task, role, task -


forgive newbie question, execute 3 tasks , use 2 roles in playbook, in order:

  1. task
  2. role
  3. task
  4. role
  5. task

this have far (task, role, task):

--- - name: task role task   hosts: 127.0.0.1   connection: local   gather_facts: false    pre_tasks:    - name: task first      foo:    roles:   - role: role second     foo:    post_tasks:     - name: task third      foo: 

is possible or should changing tasks roles?

i recommend create roles post , pre tasks ansible.

your site.yml must this:

--- - hosts: localhost   remote_user: "{{remote_user}}"   sudo: yes   gather_facts: false   roles:     - pre     - main_role     - post 

in roles folder must have 3 roles, pre, post , main_role.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -