# ansible-playbook ./plug_config.yml -e ansible_hosts=nameofhost
- name: Set Plug Parameters
  hosts: "{{ansible_hosts}}"  # pass as -e ansible_hosts=wti_demo on the commandline
  collections:
     - wti.remote
  connection: local
  gather_facts: False

  tasks:
    - set_fact: use_https=True
      when: use_https is undefined
    - set_fact: validate_certs=True
      when: validate_certs is undefined

    - name: run Set Plug Parameters
      cpm_plugconfig:
        cpm_action: "setplugconfig"
        cpm_url: "{{ansible_host}}"
        cpm_username: "{{ansible_user}}"
        cpm_password: "{{ansible_pw}}"
        plug_id: "2"  # plug 2 is being changed
        plug_name: "plugname2"
        plug_bootdelay: 1
        plug_default: 0
        plug_bootpriority: 99
        use_https: "{{use_https}}"
        validate_certs: "{{validate_certs}}"

      register: testout
    - name: dump test output
      debug:
        msg: "{{ testout }}"
