ansible task inside role not getting skipped [travis] -


so have directory structure

$ tree . ├── ansible.cfg ├── play.yml ├── roles │   ├── create_new_user │   │   ├── defaults │   │   │   └── main.yml │   │   └── tasks │   │       └── main.yml │   ├── update │   │   └── tasks │   │       └── main.yml └── tests     ├── inventory     └── test.yml 

inside .travis.yml file

--- sudo: required dist: trusty  language: python python: "2.7"  # doc: https://docs.travis-ci.com/user/customizing-the-build#build-matrix env:   - ansible_version=2.0.0.0   - ansible_version=1.9.6   - user=tasdik  install:   - if [ "$ansible_version" = "latest" ]; pip install ansible; else pip install ansible==$ansible_version; fi   - if [ "$ansible_version" = "latest" ]; pip install ansible-lint; fi  script:   - ansible-playbook -i tests/inventory tests/test.yml --syntax-check   - ansible-playbook -i tests/inventory tests/test.yml -vvvv --skip-tags "update, copy_host_ssh_id"    # check user created or not   - id -u $user | grep -q "no" && (echo "user not found" && exit 1) || (echo "user found" && exit 0) 

i trying skip task inside role inside roles/create_new_user/tasks/main.yml

but task not getting skipped. role in question

--- - name: copy .ssh/id_rsa host box remote box user {{ username }}   become: true   copy:      src: ~/.ssh/id_rsa.pub     dest: /home/{{ username }}/.ssh/authorized_keys     mode: 0600     owner: "{{ username }}"     group: "{{ username }}"   tags:     - copy_host_ssh_id 

contents of tests/test.yml

--- - hosts: localhost   connection: local   become: true   roles:     - {role: ../roles/update}     - {role: ../roles/create_new_user} 

travis build

docs:

remove space in tags enumeration string (quotes unnecessary because have no spaces) :

--skip-tags update,copy_host_ssh_id 

Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -