From 165b48cd615d64e4fedb7671f1f278e81eaf706a Mon Sep 17 00:00:00 2001 From: GnomeZworc Date: Mon, 24 Nov 2025 23:30:06 +0100 Subject: [PATCH] split role in multiple files Signed-off-by: GnomeZworc --- tasks/dnsmasq.yml | 20 +++++++++++++++++ tasks/git.yml | 27 +++++++++++++++++++++++ tasks/main.yml | 53 ++++++---------------------------------------- tasks/packages.yml | 6 ++++++ 4 files changed, 59 insertions(+), 47 deletions(-) create mode 100644 tasks/dnsmasq.yml create mode 100644 tasks/git.yml create mode 100644 tasks/packages.yml diff --git a/tasks/dnsmasq.yml b/tasks/dnsmasq.yml new file mode 100644 index 0000000..f0ea1e4 --- /dev/null +++ b/tasks/dnsmasq.yml @@ -0,0 +1,20 @@ +--- + +- name: disable and stop dnsmasq + ansible.builtin.systemd: + name: "dnsmasq.service" + enabled: False + state: "stopped" + masked: true + notify: systemctl daemon-reload + +- name: deploy dnsmasq + ansible.builtin.template: + src: etc/systemd/system/dnsmasq.j2 + dest: "/etc/systemd/system/dnsmasq@.service" + notify: systemctl daemon-reload + +- name: deploy dnsmasq in netns + ansible.builtin.template: + src: usr/local/bin/run-dnsmasq-in-netns.sh.j2 + dest: "/usr/local/bin/run-dnsmasq-in-netns.sh" \ No newline at end of file diff --git a/tasks/git.yml b/tasks/git.yml new file mode 100644 index 0000000..5ae7d55 --- /dev/null +++ b/tasks/git.yml @@ -0,0 +1,27 @@ +--- + +- name: Cloner un two_with_git + ansible.builtin.git: + repo: "https://{{ __git.__user }}:{{ __git.__token }}@{{ __git.__host }}/syonad/two_with_bash.git" + dest: "/opt/two_with_bash" + version: "main" + +- name: Cron git pull two_with_git + ansible.builtin.cron: + name: "update_repo_two_with_git" + user: "root" + minute: "*/5" + job: "cd /opt/two_with_bash && git pull > /var/log/git-pull.log 2>&1" + +- name: Cloner un two + ansible.builtin.git: + repo: "https://{{ __git.__user }}:{{ __git.__token }}@{{ __git.__host }}/syonad/two.git" + dest: "/opt/two" + version: "main" + +- name: Cron git pull two + ansible.builtin.cron: + name: "update_repo_two" + user: "root" + minute: "*/5" + job: "cd /opt/two && git pull > /var/log/git-pull.log 2>&1" \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml index d4a534d..494b80a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,51 +1,10 @@ --- -- name: "Install packages" - apt: - name: "{{ item.key }}" - loop: "{{ __packages | dict2items }}" +- name: import packages + import_tasks: packages.yml -- name: Cloner un two_with_git - ansible.builtin.git: - repo: "https://{{ __git.__user }}:{{ __git.__token }}@{{ __git.__host }}/syonad/two_with_bash.git" - dest: "/opt/two_with_bash" - version: "main" +- name: import git + import_tasks: git.yml -- name: Cron git pull two_with_git - ansible.builtin.cron: - name: "update_repo_two_with_git" - user: "root" - minute: "*/5" - job: "cd /opt/two_with_bash && git pull > /var/log/git-pull.log 2>&1" - -- name: Cloner un two - ansible.builtin.git: - repo: "https://{{ __git.__user }}:{{ __git.__token }}@{{ __git.__host }}/syonad/two.git" - dest: "/opt/two" - version: "main" - -- name: Cron git pull two - ansible.builtin.cron: - name: "update_repo_two" - user: "root" - minute: "*/5" - job: "cd /opt/two && git pull > /var/log/git-pull.log 2>&1" - -- name: disable and stop dnsmasq - ansible.builtin.systemd: - name: "dnsmasq.service" - enabled: False - state: "stopped" - masked: true - notify: systemctl daemon-reload - -- name: deploy dnsmasq - ansible.builtin.template: - src: etc/systemd/system/dnsmasq.j2 - dest: "/etc/systemd/system/dnsmasq@.service" - notify: systemctl daemon-reload - -- name: deploy dnsmasq in netns - ansible.builtin.template: - src: usr/local/bin/run-dnsmasq-in-netns.sh.j2 - dest: "/usr/local/bin/run-dnsmasq-in-netns.sh" \ No newline at end of file +- name: import dnsmasq + import_tasks: dnsmasq.yml \ No newline at end of file diff --git a/tasks/packages.yml b/tasks/packages.yml new file mode 100644 index 0000000..60e5c13 --- /dev/null +++ b/tasks/packages.yml @@ -0,0 +1,6 @@ +--- + +- name: "Install packages" + apt: + name: "{{ item.key }}" + loop: "{{ __packages | dict2items }}" \ No newline at end of file