Skip to content

Gives an error when trying to run the playbook (pb_f5_onboard.yml) a second time. #2

@alic-antunez

Description

@alic-antunez

Trying to add a user to an F5 bigip with Ansible:
This is my config:


ubuntu1@alicantunez:~/f5_ansible$ cat hosts
[ltm]
ltm01 Ansible_host=10.10.10.136

ubuntu1@alicantunez:~/f5_ansible$ cat group_vars/all.yml
conn_parameters:
user: admin
password: alic2121.
server: "{{ Ansible_host }}"
server_port: 443
validate_certs: no

admin_passwd: NewP@sswd
users:
- name: Ansible
passwd: Ansible123
role: all:admin
state: present

ubuntu1@alicantunez:~/f5_ansible$ cat ansible.cfg
[defaults]
inventory=hosts
retry_files_enabled=False
gathering=explicit
host_key_checking=False

ubuntu1@alicantunez:~/f5_ansible$ cat pb_f5_onboard.yml

  • name: Onboarding a New LTM
    hosts: ltm01
    connection: local
    tasks:
    • name: "P1T1: Create new Users"
      bigip_user:
      username_credential: "{{ item.name }}"
      password_credential: "{{ item.passwd }}"
      partition_access: "{{ item.role }}"
      state: "{{ item.state | default('present')}}"
      provider: "{{ conn_parameters }}"
      loop: "{{ users }}"

    • name: "P1T1: Update admin Password"
      bigip_user:
      username_credential: admin
      password_credential: "{{ admin_passwd }}"
      state: present
      provider: "{{ conn_parameters }}"


The first time I run the playbook the result is successful:

ubuntu1@alicantunez:~/f5_ansible$ ansible-playbook pb_f5_onboard.yml

PLAY [Onboarding a New LTM] **********************************************************************************************************************************

TASK [P1T1: Create new Users] ********************************************************************************************************************************
changed: [ltm01] => (item={'name': 'Ansible', 'passwd': 'Ansible123', 'role': 'all:admin', 'state': 'present'})
[WARNING]: Module did not set no_log for update_password

TASK [P1T1: Update admin Password] ***************************************************************************************************************************
changed: [ltm01]

PLAY RECAP ***************************************************************************************************************************************************
ltm01 : ok=2 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

But when I try to run it a second time (having deleted the user from the first run), I get the following error.

Captura de pantalla 2021-07-25 a la(s) 21 24 17

Why is this happening and how can I correct it?
Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions