I’ve been wondering what the best way of accomplishing this is:
- We have a number of customers
- Each customer has one or more (Oracle Weblogic) clusters
- Each cluster has an Admin node
- I want to generate an (passphrase-less) ssh key for the “oracle” user on each Admin node
- The public key of the Admin node has to be installed on each node in the cluster so that the “oracle” user on the Admin node can reach each node non-interactively
I have a script that can be run on a host which prints out a list of hostnames in the cluster, iff the host is an Admin node:
it seems you want something like:
- name: generate ssh key
...
when: clusterdata.stdout_lines
- name: install generated key
...
when: not clusterdata.stdout_lines
or you can check the length of clusterdata.stdout_lines, which seems
to be only populated on the admin node. I would still add it to your
inventory as it is easier to segregate by groups or a group/host var.
Thanks, something like that might work for me, in combination with setting some local facts on the Admin server. I’ll be trying a couple of things…
Am I right in assuming that the following:
- name: create key for oracle
user: name=oracle createhome=no generate_ssh_key=yes ssh_key_file=.ssh/id_oracle ssh_key_passphrase=“” state=present
will not change anything for an existing oracle user, besides creating an ssh key if it doesn’t yet exist?
Paul