Skip to content

Commit

Permalink
Merge pull request #19 from ZLLentz/enh_pmpsdb_client
Browse files Browse the repository at this point in the history
ENH: prepare PLC for pmpsdb_client
  • Loading branch information
ZLLentz committed Mar 26, 2024
2 parents 24b4a11 + 6fdc0a1 commit 8496758
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 0 deletions.
4 changes: 4 additions & 0 deletions group_vars/tcbsd_plcs/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ use_psntp: true
dynamic_ams: true
# tc_ams_net_id: 0.0.0.0.1.1

# Extra user for non-admin activities
create_user: true
create_username: ecs-user

# set static IP on x000 (mac id 2)
x000_set_static_ip: true
x000_static_ip: 192.168.1.10
Expand Down
4 changes: 4 additions & 0 deletions group_vars/tcbsd_vms/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ use_psntp: false
# Static AMS net id = set AMS net id to the value of tc_ams_net_id
dynamic_ams: false

# Extra user for non-admin activities
create_user: false
# create_username:

# set static IP on x000 (mac id 2)
x000_set_static_ip: false
x000_static_ip: 192.168.1.10
Expand Down
4 changes: 4 additions & 0 deletions host_vars/plc-tmo-tmp-vac/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ ansible_host: plc-tmo-tmp-vac
#dynamic_ams: true
## tc_ams_net_id: 0.0.0.0.1.1
#
## Extra user for non-admin activities
#create_user: true
#create_username: ecs-user
#
## set static IP on x000 (mac id 2)
#x000_set_static_ip: true
#x000_static_ip: 192.168.1.10
Expand Down
4 changes: 4 additions & 0 deletions host_vars/plc-tst-bsd1/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ ansible_host: plc-tst-bsd1
#dynamic_ams: true
## tc_ams_net_id: 0.0.0.0.1.1
#
## Extra user for non-admin activities
#create_user: true
#create_username: ecs-user
#
## set static IP on x000 (mac id 2)
#x000_set_static_ip: true
#x000_static_ip: 192.168.1.10
Expand Down
4 changes: 4 additions & 0 deletions host_vars/plc-tst-bsd2/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ ansible_host: plc-tst-bsd2
#dynamic_ams: true
## tc_ams_net_id: 0.0.0.0.1.1
#
## Extra user for non-admin activities
#create_user: true
#create_username: ecs-user
#
## set static IP on x000 (mac id 2)
#x000_set_static_ip: true
#x000_static_ip: 192.168.1.10
Expand Down
29 changes: 29 additions & 0 deletions tcbsd-provision-playbook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -340,3 +340,32 @@
when: static_ip_x001_set.changed or dhcp_x001_set.changed
ansible.builtin.wait_for_connection:
delay: 2

# Useful for apps that need PLC access but not Admin-level config change access
# We need to manually set the password ourselves later via "doas passwd username"
- name: Create or Remove non-admin User
ansible.builtin.user:
name: "{{ create_username }}"
state: "{{ create_user | ternary('present', 'absent') }}"
shell: /usr/local/bin/bash'

# By default, only pubkey and keyboard interactive are enabled
# Password access is useful for apps like pmpsdb_client
- name: Configure sshd for password access
register: sshd_configure
ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config
line: "PasswordAuthentication yes"
insertafter: "^#PasswordAuthentication"

- name: Reload sshd
when: sshd_configure.changed
ansible.builtin.service:
name: sshd
enabled: yes
state: reloaded

- name: Verify ssh still works
when: sshd_configure.changed
ansible.builtin.wait_for_connection:
delay: 2

0 comments on commit 8496758

Please sign in to comment.