From 42cd710101c8129dbbac5b72b4d3e5ebeae3a546 Mon Sep 17 00:00:00 2001 From: L3D Date: Thu, 12 Mar 2020 04:01:23 +0100 Subject: [PATCH] start creating ssh key creation for custom config --- README.md | 2 +- tasks/configure_custom_config.yml | 16 ++++++++++++++++ tasks/main.yml | 3 +++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 tasks/configure_custom_config.yml diff --git a/README.md b/README.md index 1c3a5ff..75f237f 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ weechat: weechat: user: "{{ ansible_user_id }}" ``` -+ the user to use weechat with. This value is used in the ``autostart`` task and the ``{{ weechat.home_directory }}`` variable ++ the user to use weechat with. This value is used in the ``autostart`` task, the ``custom_config`` task and the ``{{ weechat.home_directory }}`` variable ```yaml weechat: diff --git a/tasks/configure_custom_config.yml b/tasks/configure_custom_config.yml new file mode 100644 index 0000000..be84512 --- /dev/null +++ b/tasks/configure_custom_config.yml @@ -0,0 +1,16 @@ +--- +- name: create ssh key pair (if needed) + become: true + become_user: "{{ weechat.user }}" + openssh_keypair: + path: "{{ weechat.home_directory }}/../.ssh/id_ed25519" + type: ed25519 + register: ssh_key_pair + when: weechat.custom_config.gen_ssh_key_pair | bool + +- name: print ssh public key to user + pause: + prompt: "Your ssh public key:\n\n{{ ssh_key_pair.public_key }}\n\n" + when: + - weechat.custom_config.gen_ssh_key_pair | bool + - ssh_key_pair.changed diff --git a/tasks/main.yml b/tasks/main.yml index b805a49..5000d4d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -9,6 +9,9 @@ - include_tasks: "install-{{ ansible_os_family|lower }}.yml" when: weechat.install | bool +- include_tasks: configure_custom_config.yml + when: weechat.use_custom_config | bool + - include_tasks: configure_plugins.yml when: weechat.install_plugins | bool