您最多选择25个主题
主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
此仓库已存档。您可以查看文件和克隆,但不能推送或创建工单/合并请求。
|
- ---
-
- - hosts:
- - servers
- - desktops
- - laptops
- remote_user: root
- roles:
- - name: users
-
- # - hosts: desktops:laptops
- # remote_user: root
- # tasks:
- # - name: /etc/ssh/ssh_config
- # template:
- # src: ssh_config.j2
- # dest: /etc/ssh/ssh_config
- # - name: ssh known hosts
- # known_hosts:
- # name: "{{item}}"
- # key: "{{item}},{{hostvars[item].ansible_default_ipv4.address}} {{hostvars[item].ansible_ssh_host_key_ed25519_public_keytype}} {{hostvars[item].ansible_ssh_host_key_ed25519_public}}"
- # path: /etc/ssh/ssh_known_hosts
- # loop: "{{groups.servers}}"
-
- - hosts:
- - servers
- remote_user: root
- tasks:
-
- - name: authorize ssh public keys
- authorized_key:
- user: "{{item.name}}"
- key: "{{item.ssh_public_key}}"
- loop: "{{ hostvars | json_query(\"*.user_ssh_keys_info.results[]\") }}"
- loop_control:
- label: "{{ item.name }}"
- tags:
- - users
|