Hello Folk,
Need one help in updating the key to sshd_config file depending on the OS
version.
I ve folder structure like below
- roles
- sshd
- tasks
main.yml
- vars
main.yml
- template
main.yml
I want to update */template/main.yml* like
{% if ansible_distribution_major_version == "8"}
Insert RHEL8 KEY etc/ssh/sshd_config
{% if ansible_distribution_major_version == "7"}
Inset RHEL7 KEY to etc/ssh/sshd_config
{% if ansible_distribution == "Amazon" }
Inset Amazon KEY to etc/ssh/sshd_config
{% endif %}
my *tasks/main.yml *
- name : Update the key in sshd_config
template:
src: template/sshd.conf.j2
dest: /etc/ssh/sshd_config
Can I write KEY in Vars/main.yml and update the /etc/ssh/sshd_config file.
The above is my approach till now but please somebody help me how can I
update the sshd_config file with the key.
Like in */vars/main.yml*
RHEL8_KEY = xyz
RHEL7_KEY = abc
RHEL6_KEY = mno
AMAZON_KEY = amazon
Regards
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAEuB3Ar4NR0qzNU7kH_H_dBUsaEc9KsPDBZw2O1ON4DY-MNKVA%40mail.gmail.com.