diff options
Diffstat (limited to 'ansible_collections/wti/remote/playbooks/cpm_user')
4 files changed, 148 insertions, 0 deletions
diff --git a/ansible_collections/wti/remote/playbooks/cpm_user/user_add.yml b/ansible_collections/wti/remote/playbooks/cpm_user/user_add.yml new file mode 100644 index 000000000..a15fe25d9 --- /dev/null +++ b/ansible_collections/wti/remote/playbooks/cpm_user/user_add.yml @@ -0,0 +1,45 @@ +# ansible-playbook ./user_add.yml -e ansible_hosts=nameofhost +- name: Add New User + hosts: "{{ansible_hosts}}" # pass as -e ansible_hosts=wti_demo on the commandline + collections: + - wti.remote + connection: local + gather_facts: False + + vars_prompt: + - name: "user_name" + prompt: "Enter Username" + private: no + - name: "user_pass" + prompt: "Enter Password" + + tasks: + - set_fact: use_https=True + when: use_https is undefined + - set_fact: validate_certs=True + when: validate_certs is undefined + + - name: run Add New User + cpm_user: + cpm_action: "adduser" + cpm_url: "{{ansible_host}}" + cpm_username: "{{ansible_user}}" + cpm_password: "{{ansible_pw}}" + user_name: "{{user_name}}" # pass as -e user_name=sammy on the commandline + user_pass: "{{user_pass}}" + user_accesslevel: 1 + user_accessserial: 0 + user_accessapi: 1 + user_accessweb: 0 + user_accessoutbound: 1 + user_accessssh: 1 + user_portaccess: "10001110" + user_plugaccess: "11110000" + user_callbackphone: "9495551212" + use_https: "{{use_https}}" + validate_certs: "{{validate_certs}}" + + register: output + - name: dump JSON output + debug: + msg: "{{ output.data }}" diff --git a/ansible_collections/wti/remote/playbooks/cpm_user/user_delete.yml b/ansible_collections/wti/remote/playbooks/cpm_user/user_delete.yml new file mode 100644 index 000000000..e6e45054c --- /dev/null +++ b/ansible_collections/wti/remote/playbooks/cpm_user/user_delete.yml @@ -0,0 +1,33 @@ +# ansible-playbook ./user_delete.yml -e ansible_hosts=nameofhost +- name: Delete Exiting User + hosts: "{{ansible_hosts}}" # pass as -e ansible_hosts=wti_demo on the commandline + collections: + - wti.remote + connection: local + gather_facts: False + + vars_prompt: + - name: "user_name" + prompt: "Enter Username" + private: no + + tasks: + - set_fact: use_https=True + when: use_https is undefined + - set_fact: validate_certs=True + when: validate_certs is undefined + + - name: run Delete Exiting User + cpm_user: + cpm_action: "deleteuser" + cpm_url: "{{ansible_host}}" + cpm_username: "{{ansible_user}}" + cpm_password: "{{ansible_pw}}" + user_name: "{{user_name}}" # pass as -e user_name=sammy on the commandline + use_https: "{{use_https}}" + validate_certs: false + + register: output + - name: dump JSON output + debug: + msg: "{{ output.data }}" diff --git a/ansible_collections/wti/remote/playbooks/cpm_user/user_edit.yml b/ansible_collections/wti/remote/playbooks/cpm_user/user_edit.yml new file mode 100644 index 000000000..00dc46ba5 --- /dev/null +++ b/ansible_collections/wti/remote/playbooks/cpm_user/user_edit.yml @@ -0,0 +1,37 @@ +# ansible-playbook ./user_edit.yml -e ansible_hosts=nameofhost +- name: Edit Exiting User + hosts: "{{ansible_hosts}}" # pass as -e ansible_hosts=wti_demo on the commandline + collections: + - wti.remote + connection: local + gather_facts: False + + vars_prompt: + - name: "user_name" + prompt: "Enter Username" + private: no + - name: "user_pass" + prompt: "Enter Password" + + tasks: + - set_fact: use_https=True + when: use_https is undefined + - set_fact: validate_certs=True + when: validate_certs is undefined + + - name: Run Edit Existing User + cpm_user: + cpm_action: "edituser" + cpm_url: "{{ansible_host}}" + cpm_username: "{{ansible_user}}" + cpm_password: "{{ansible_pw}}" + user_name: "{{user_name}}" # pass as -e user_name=sammy on the commandline + user_pass: "{{user_pass}}" # pass as -e user_pass=sammy on the commandline + user_accesslevel: 3 + use_https: "{{use_https}}" + validate_certs: false + + register: testout + - name: dump test output + debug: + msg: "{{ testout['data'] }}" diff --git a/ansible_collections/wti/remote/playbooks/cpm_user/user_get.yml b/ansible_collections/wti/remote/playbooks/cpm_user/user_get.yml new file mode 100644 index 000000000..e782b4c2f --- /dev/null +++ b/ansible_collections/wti/remote/playbooks/cpm_user/user_get.yml @@ -0,0 +1,33 @@ +# ansible-playbook ./user_get.yml -e ansible_hosts=nameofhost +- name: Get User Parameters + hosts: "{{ansible_hosts}}" # pass as -e ansible_hosts=wti_demo on the commandline + collections: + - wti.remote + connection: local + gather_facts: False + + vars_prompt: + - name: "user_name" + prompt: "Enter Username" + private: no + + tasks: + - set_fact: use_https=True + when: use_https is undefined + - set_fact: validate_certs=True + when: validate_certs is undefined + + - name: run Get User Parameters + cpm_user: + cpm_action: "getuser" + cpm_url: "{{ansible_host}}" + cpm_username: "{{ansible_user}}" + cpm_password: "{{ansible_pw}}" + user_name: "{{user_name}}" # pass as -e user_name=sammy on the commandline + use_https: "{{use_https}}" + validate_certs: false + + register: output + - name: dump JSON output + debug: + msg: "{{ output.data }}" |