Put it in a block
This commit is contained in:
parent
cfef88b78f
commit
84c30c482b
|
@ -1,4 +1,52 @@
|
|||
---
|
||||
|
||||
- include: pelican.yml
|
||||
tags: pelican
|
||||
- block:
|
||||
- name: Install nginx and dependencies
|
||||
apt:
|
||||
name: [nginx, git]
|
||||
|
||||
- name: Create user
|
||||
user:
|
||||
name: "{{ pelican_user }}"
|
||||
shell: /bin/false
|
||||
system: yes
|
||||
home: "{{ pelican_home }}"
|
||||
|
||||
- name: Clone repo
|
||||
git:
|
||||
repo: "{{ pelican_repo }}"
|
||||
dest: "{{ pelican_home }}/repo"
|
||||
register: clone_repo
|
||||
|
||||
- name: pip install pelican markdown
|
||||
pip:
|
||||
name: [pelican, markdown]
|
||||
virtualenv_command: /usr/bin/python3 -m venv
|
||||
virtualenv: "{{ pelican_home }}/venv"
|
||||
|
||||
- name: Ensure pelican can write in its output dir
|
||||
file:
|
||||
path: "{{ pelican_home }}/www/"
|
||||
state: directory
|
||||
owner: "{{ pelican_user }}"
|
||||
mode: 0755
|
||||
|
||||
- name: Build pelican
|
||||
when: clone_repo.changed
|
||||
command: "{{ pelican_home }}/venv/bin/pelican -o {{ pelican_home }}/www/"
|
||||
args:
|
||||
chdir: "{{ pelican_home }}/repo/{{ pelican_path_in_repo }}"
|
||||
become: true
|
||||
become_method: su
|
||||
become_user: "{{ pelican_user }}"
|
||||
become_flags: "-s /bin/sh"
|
||||
|
||||
- name: Configure nginx
|
||||
template:
|
||||
src: nginx-vhost
|
||||
dest: "/etc/nginx/conf.d/{{ pelican_domain }}.conf"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: reload nginx
|
||||
tags: [pelican]
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
---
|
||||
|
||||
- name: Install nginx and dependencies
|
||||
apt:
|
||||
name: [nginx, git]
|
||||
|
||||
- name: Create user
|
||||
user:
|
||||
name: "{{ pelican_user }}"
|
||||
shell: /bin/false
|
||||
system: yes
|
||||
home: "{{ pelican_home }}"
|
||||
|
||||
- name: Clone repo
|
||||
git:
|
||||
repo: "{{ pelican_repo }}"
|
||||
dest: "{{ pelican_home }}/repo"
|
||||
register: clone_repo
|
||||
|
||||
- name: pip install pelican markdown
|
||||
pip:
|
||||
name: [pelican, markdown]
|
||||
virtualenv_command: /usr/bin/python3 -m venv
|
||||
virtualenv: "{{ pelican_home }}/venv"
|
||||
|
||||
- name: Ensure pelican can write in its output dir
|
||||
file:
|
||||
path: "{{ pelican_home }}/www/"
|
||||
state: directory
|
||||
owner: "{{ pelican_user }}"
|
||||
mode: 0755
|
||||
|
||||
- name: Build pelican
|
||||
when: clone_repo.changed
|
||||
command: "{{ pelican_home }}/venv/bin/pelican -o {{ pelican_home }}/www/"
|
||||
args:
|
||||
chdir: "{{ pelican_home }}/repo/{{ pelican_path_in_repo }}"
|
||||
become: true
|
||||
become_method: su
|
||||
become_user: "{{ pelican_user }}"
|
||||
become_flags: "-s /bin/sh"
|
||||
|
||||
- name: Configure nginx
|
||||
template:
|
||||
src: nginx-vhost
|
||||
dest: "/etc/nginx/conf.d/{{ pelican_domain }}.conf"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: reload nginx
|
|
@ -1,4 +1,29 @@
|
|||
---
|
||||
|
||||
- include: static.yml
|
||||
tags: static
|
||||
- block:
|
||||
- name: Install nginx and dependencies
|
||||
apt:
|
||||
name: [nginx, git]
|
||||
|
||||
- name: Create user
|
||||
user:
|
||||
name: "{{ static_user }}"
|
||||
shell: /bin/false
|
||||
system: yes
|
||||
home: "{{ static_home }}"
|
||||
|
||||
- name: Clone repo
|
||||
git:
|
||||
repo: "{{ static_repo }}"
|
||||
dest: "{{ static_home }}/www/"
|
||||
register: clone_repo
|
||||
|
||||
- name: Configure nginx
|
||||
template:
|
||||
src: nginx-vhost
|
||||
dest: "/etc/nginx/conf.d/{{ static_domain }}.conf"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: reload nginx
|
||||
tags: [static]
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
---
|
||||
|
||||
- name: Install nginx and dependencies
|
||||
apt:
|
||||
name: [nginx, git]
|
||||
|
||||
- name: Create user
|
||||
user:
|
||||
name: "{{ static_user }}"
|
||||
shell: /bin/false
|
||||
system: yes
|
||||
home: "{{ static_home }}"
|
||||
|
||||
- name: Clone repo
|
||||
git:
|
||||
repo: "{{ static_repo }}"
|
||||
dest: "{{ static_home }}/www/"
|
||||
register: clone_repo
|
||||
|
||||
- name: Configure nginx
|
||||
template:
|
||||
src: nginx-vhost
|
||||
dest: "/etc/nginx/conf.d/{{ static_domain }}.conf"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: reload nginx
|
Loading…
Reference in New Issue
Block a user