From a21a09366e6c3e3e40cabc11a8997b85507863ee Mon Sep 17 00:00:00 2001 From: Pierre Kunzli <pierre.kuenzli@unige.ch> Date: Tue, 13 Aug 2024 15:17:47 +0200 Subject: [PATCH] working on ansible deployment --- ansible/configure_app.yml | 11 ++++++--- ansible/configure_runtime.yml | 43 +++++++++++++++++++++++++++++++++-- ansible/hosts | 2 +- ansible/vars.yml | 2 +- 4 files changed, 51 insertions(+), 7 deletions(-) diff --git a/ansible/configure_app.yml b/ansible/configure_app.yml index 288bfc3..e8c5b20 100644 --- a/ansible/configure_app.yml +++ b/ansible/configure_app.yml @@ -1,9 +1,14 @@ - name: Git checkout bootiful project - become: false + become: true + become_user: bootiful ansible.builtin.git: repo: "{{ git_repo }}" - dest: "{{ git_clone_dest }}" + dest: "/home/bootiful/{{ git_clone_dest }}" version: "{{ git_branch }}" register: git_checkout_result - + +#- name: Build bootiful +# become: false +# community.general.make: +# chdir: "{{ git_clone_dest }}" diff --git a/ansible/configure_runtime.yml b/ansible/configure_runtime.yml index 8ee2711..2f99bac 100644 --- a/ansible/configure_runtime.yml +++ b/ansible/configure_runtime.yml @@ -11,8 +11,47 @@ ansible.builtin.apt: pkg: - python3-pip + - python-is-python3 + - pkg-config + - bison + - flex - git - build-essential - - docker.io - - docker-compose + - automake + - autoconf + - autogen + - libtool + - shtool + - htop + - nfs-common + - nfs-kernel-server + - rpcbind + - acl + - autopoint state: latest + +#- docker.io +#- docker-compose + +- name: Start service nfs, if not started + become: true + ansible.builtin.service: + name: nfs-utils.service + state: started + enabled: true + +- name: Create a user 'bootiful' with a home directory + become: true + ansible.builtin.user: + name: bootiful + create_home: yes + shell: /bin/bash + groups: docker + append: yes + +- name: Copying shh key to remote host + become: true + authorized_key: + user: bootiful + state: present + key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/id_rsa.pub')}}" diff --git a/ansible/hosts b/ansible/hosts index 37dbf69..bea5094 100644 --- a/ansible/hosts +++ b/ansible/hosts @@ -1,2 +1,2 @@ [bootiful_server] -bootiful_server_1 ansible_port=22 ansible_user=pierre ansible_host=bootiful-server +bootiful_server_1 ansible_port=22 ansible_host=bootiful-server diff --git a/ansible/vars.yml b/ansible/vars.yml index b492a29..60f0f4f 100644 --- a/ansible/vars.yml +++ b/ansible/vars.yml @@ -1,3 +1,3 @@ git_repo: "https://gitedu.hesge.ch/pierre.kunzli/bootiful.git" -git_branch: master +git_branch: ansible git_clone_dest: bootiful -- GitLab