Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
224 views
in Technique[技术] by (71.8m points)

Ansible skipping playbook at first attempt on multiple-play playbook file

I have the following playbook:

- import_playbook: "infrastructure/infrastructure.yml"
- import_playbook: "application/application.yml"

Inside these playbooks there are other playbooks being invoked, what happens is that in a specific moment one playbook will be executed in the application.yml pointed to cicd_servers group, and it will be skipped unintentionally.

See my inventory below:

[cicd_servers] 
sig-cicd-01 ansible_connection=local

This playbook in specific is that one below:

---
- hosts: cicd_servers   
    gather_facts: false   
    remote_user: ansible   
    connection: local

  roles:
    - application/os_setup
    - application/jdk_install
    - infrastructure/jenkins_install
    - infrastructure/maven_install
    - infrastructure/scm_install
    - infrastructure/soapui_install
    - database/sqlplus-install

################### cicd server applications ############
- hosts: cicd_servers   
    become: true   
    remote_user: ansible   
    connection: local   
  
    roles:
    - application/fmw_cicd_conf
    - application/fmw_performance_conf

I don't know why it's skipping only this host, I tried also to remove the parameters ansible_connection=local from the inventory and connection: local from the playbook to the DNS Name of the machine, and it doesn't work as well.

Note: If I just play again the same playbook it won't skip these tasks, that is, it only does not work at first attempt.

Note2: If I comment a few playbooks before it, it executes successfully at first attempt, but I need to get it as it should be.

Note3: I'm using ansible 2.9.10 version.

Below I registered 2 outputs with verbose (-vvvv) to try to identify something, but the output in the part being skipped doesn't say nothing.

output_1 (success)
PLAY [cicd_servers] **********************************************************************************************************************************************************************************
META: ran handlers
Thursday 21 January 2021  13:34:33 +0000 (0:00:21.729)       0:01:55.599 ******
included: /home/ansible/workspace_VFPT/roles/application/os_setup/tasks/infra.yml for sig-cicd-01.mgm.mw.sat.stp.vodafone.pt
Thursday 21 January 2021  13:34:33 +0000 (0:00:00.063)       0:01:55.663 ******
<sig-cicd-01.mgm.mw.sat.stp.vodafone.pt> ESTABLISH SSH CONNECTION FOR USER: ansible
output_2 (failed)

PLAY [cicd_servers] **********************************************************************************************************************************************************************************

PLAY [cicd_servers] **********************************************************************************************************************************************************************************

If you guys have any idea what is causing it, please let me know.

question from:https://stackoverflow.com/questions/65830294/ansible-skipping-playbook-at-first-attempt-on-multiple-play-playbook-file

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...