Hi,
these are the ansible role config files
ansible/runsetup.yml
---
- hosts:
- cmp
become: true
tags:
- nfs_server
roles:
- nfs
- hosts:
- hardware:!cmp
- vms
become: true
tags:
- nfs_client
roles:
- nfs
ansible/nfs/tasks/main.yml
---
# tasks file for installing nfs
- name: configure nfs server
include_tasks: nfs_server.yml
tags:
- nfs_server
- name: configure nfs client
include_tasks: nfs_client.yml
tags:
- nfs_client
/ansible/nfs/tasks/ nfs_server.yml
---
- name: Create shared nfs directory
...
- name: Configure /etc/exports
...
- name: set symlink /media/nfs-share -> /Data/nfs-share
...
- name: set symlink to ansible hosts.ini
...
/ansible/nfs/tasks/ nfs_clientym
---
- name: Create sharing nfs directory on hosts/guests
...
- name: Mounting /media/nfs-share
...
This is the ansible console output -
all tasks included in nfs_server.yml and nfs_client.yml are exectuted for cmp (server) and then it starts again with nfs_server.yml for top1...(clients) and stops because set symlink cannot be exectuted on clients, which is ok.
in this case tagging in roles doesn't work.
PLAY [cmp] ***************************************************************************************************************************************************************
TASK [Gathering Facts] ***************************************************************************************************************************************************
ok: [cmp1]
TASK [configure nfs server] **********************************************************************************************************************************************
included: /Data/nfs-share/ansible/nfs/tasks/nfs_server.yml for cmp1
TASK [Create shared nfs directory] ***************************************************************************************************************************************
ok: [cmp1] =>
TASK [nfs : Configure /etc/exports] **************************************************************************************************************************************
ok: [cmp1] =>
TASK [nfs : Commmand exportfs] *******************************************************************************************************************************************
skipping: [cmp1] =>
TASK [set symlink /media/nfs-share -> /Data/nfs-share] *******************************************************************************************************************
ok: [cmp1] =>
TASK [nfs : set symlink to ansible hosts.ini] ****************************************************************************************************************************
changed: [cmp1] =>
TASK [configure nfs client] **********************************************************************************************************************************************
included: /Data/nfs-share/ansible/nfs/tasks/nfs_client.yml for cmp1
TASK [Create sharing nfs directory on hosts/guests] **********************************************************************************************************************
ok: [cmp1] =>
TASK [Mounting /media/nfs-share] *****************************************************************************************************************************************
changed: [cmp1] =>
PLAY [hardware:!cmp,vms] *************************************************************************************************************************************************
TASK [Gathering Facts] ***************************************************************************************************************************************************
ok: [top1]
...
TASK [configure nfs server] **********************************************************************************************************************************************
included: /Data/nfs-share/ansible/nfs/tasks/nfs_server.yml for top1, top2,...
TASK [Create shared nfs directory] ***************************************************************************************************************************************
changed: [top1]
...
TASK [nfs : Configure /etc/exports] **************************************************************************************************************************************
hanged: [top1] =>
...
TASK [nfs : Commmand exportfs] *******************************************************************************************************************************************
skipping: [top1]
...
TASK [set symlink /media/nfs-share -> /Data/nfs-share] *******************************************************************************************************************
fatal: [top1]:
....
PLAY RECAP ***************************************************************************************************************************************************************
Thx,
Robert