1# ansible-playbook ./serial_port_config.yml -e ansible_hosts=nameofhost
2- name: Set Serial Port Parameters
3  hosts: "{{ansible_hosts}}"  # pass as -e ansible_hosts=wti_demo on the commandline
4  collections:
5     - wti.remote
6  connection: local
7  gather_facts: False
8
9  tasks:
10  - set_fact: use_https=True
11    when: use_https is undefined
12  - set_fact: validate_certs=True
13    when: validate_certs is undefined
14
15  - name: run Set Port Parameters of Port 4
16    cpm_serial_port_config:
17      cpm_url: "{{ansible_host}}"
18      cpm_username: "{{ansible_user}}"
19      cpm_password: "{{ansible_pw}}"
20      port: 4
21      baud: 4
22      portname: "Sam4"
23      handshake: 2
24      stopbits: 1
25      parity: 0
26      mode: 1
27      cmd: 0
28      seq: 1
29      tout: 1
30      echo: 0
31      break_allow: True
32      logoff: "^W"
33      use_https: "{{use_https}}"
34      validate_certs: "{{validate_certs}}"
35
36    register: testout
37  - name: dump test output
38    debug:
39      msg: "{{ testout['data'] }}"
40