2017-04-06 79 views
0

所以,我有我的目錄結構大致是這樣的ansible任務沒有得到跳過[特拉維斯]

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

裏面我.travis.yml文件

--- 
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" ]; then pip install ansible; else pip install ansible==$ANSIBLE_VERSION; fi 
    - if [ "$ANSIBLE_VERSION" = "latest" ]; then 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 is the user is created or not 
    - id -u $USER | grep -q "no" && (echo "user not found" && exit 1) || (echo "user found" && exit 0) 

我試圖跳過角色內的任務這裏面是roles/create_new_user/tasks/main.yml

但是這個任務沒有被跳過。有問題的角色

--- 
- name: Copy .ssh/id_rsa from host box to the remote box for 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 

tests/test.yml

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

特拉維斯的內容建設

DOCS:在標籤枚舉串

回答

1

刪除空間(行情也是不必要的,因爲你沒有空格):

--skip-tags update,copy_host_ssh_id