This commit is contained in:
parent
88825a76d2
commit
3be129d5d7
148
.drone.jsonnet
Normal file
148
.drone.jsonnet
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
local PipelineLinting = {
|
||||||
|
kind: "pipeline",
|
||||||
|
name: "linting",
|
||||||
|
platform: {
|
||||||
|
os: "linux",
|
||||||
|
arch: "amd64",
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: "ansible-later",
|
||||||
|
image: "xoxys/ansible-later:latest",
|
||||||
|
environment: {
|
||||||
|
PY_COLORS: 1
|
||||||
|
},
|
||||||
|
commands: [
|
||||||
|
"git clone https://gitea.rknet.org/ansible/ansible-later-policy.git ~/policy",
|
||||||
|
"ansible-later -c ~/policy/config.yml"
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
trigger: {
|
||||||
|
ref: ["refs/heads/master", "refs/tags/**", "refs/pull/**"],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
local PipelineDeployment = {
|
||||||
|
kind: "pipeline",
|
||||||
|
name: "deployment",
|
||||||
|
platform: {
|
||||||
|
os: "linux",
|
||||||
|
arch: "amd64",
|
||||||
|
},
|
||||||
|
concurrency: {
|
||||||
|
limit: 1
|
||||||
|
},
|
||||||
|
workspace: {
|
||||||
|
base: "/drone/src",
|
||||||
|
path: "xoxys.vim"
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: "ansible-molecule",
|
||||||
|
image: "xoxys/molecule:do-linux-amd64",
|
||||||
|
environment: {
|
||||||
|
DO_API_KEY: { "from_secret": "do_api_key" },
|
||||||
|
USER: "root",
|
||||||
|
MOLECULE_CUSTOM_MODULES_REPO: "https://gitea.rknet.org/ansible/custom_modules",
|
||||||
|
MOLECULE_CUSTOM_FILTERS_REPO: "https://gitea.rknet.org/ansible/custom_filters",
|
||||||
|
PY_COLORS: 1
|
||||||
|
},
|
||||||
|
commands: [
|
||||||
|
"/bin/bash /docker-entrypoint.sh",
|
||||||
|
"molecule test -s default",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
depends_on: [
|
||||||
|
"linting",
|
||||||
|
],
|
||||||
|
trigger: {
|
||||||
|
ref: ["refs/heads/master", "refs/tags/**"],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
local PipelineDocumentation = {
|
||||||
|
kind: "pipeline",
|
||||||
|
name: "documentation",
|
||||||
|
platform: {
|
||||||
|
os: "linux",
|
||||||
|
arch: "amd64",
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: "ansible-doctor",
|
||||||
|
image: "xoxys/ansible-doctor:latest",
|
||||||
|
environment: {
|
||||||
|
ANSIBLE_DOCTOR_LOG_LEVEL: "INFO",
|
||||||
|
ANSIBLE_DOCTOR_FORCE_OVERWRITE: true,
|
||||||
|
ANSIBLE_DOCTOR_EXCLUDE_FILES: "molecule/",
|
||||||
|
ANSIBLE_DOCTOR_CUSTOM_HEADER: "HEADER.md",
|
||||||
|
PY_COLORS: 1
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "push-to-repo",
|
||||||
|
image: "plugins/git-action:latest",
|
||||||
|
settings: {
|
||||||
|
actions: ["commit", "push"],
|
||||||
|
author_email: "shipper@rknet.org",
|
||||||
|
author_name: "DroneShipper",
|
||||||
|
branch: "master",
|
||||||
|
message: "[SKIP CI] update readme",
|
||||||
|
remote: "https://gitea.rknet.org/ansible/xoxys.vim",
|
||||||
|
netrc_machine: "gitea.rknet.org",
|
||||||
|
netrc_username: {"from_secret": "gitea_username"},
|
||||||
|
netrc_password: {"from_secret": "gitea_token"},
|
||||||
|
},
|
||||||
|
when: {
|
||||||
|
ref: ["refs/heads/master"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
depends_on: [
|
||||||
|
"deployment",
|
||||||
|
],
|
||||||
|
trigger: {
|
||||||
|
ref: ["refs/heads/master", "refs/tags/**", "refs/pull/**"],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
local PipelineNotification= {
|
||||||
|
kind: "pipeline",
|
||||||
|
name: "notification",
|
||||||
|
platform: {
|
||||||
|
os: "linux",
|
||||||
|
arch: "amd64",
|
||||||
|
},
|
||||||
|
clone: {
|
||||||
|
disable: true,
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: "matrix",
|
||||||
|
image: "plugins/matrix",
|
||||||
|
settings: {
|
||||||
|
homeserver: { "from_secret": "matrix_homeserver" },
|
||||||
|
roomid: { "from_secret": "matrix_roomid" },
|
||||||
|
template: "Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}",
|
||||||
|
username: { "from_secret": "matrix_username" },
|
||||||
|
password: { "from_secret": "matrix_password" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
depends_on: [
|
||||||
|
"documentation",
|
||||||
|
],
|
||||||
|
trigger: {
|
||||||
|
status: [ "success", "failure" ],
|
||||||
|
ref: ["refs/heads/master", "refs/tags/**"],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
[
|
||||||
|
PipelineLinting,
|
||||||
|
PipelineDeployment,
|
||||||
|
PipelineDocumentation,
|
||||||
|
PipelineNotification,
|
||||||
|
]
|
160
.drone.yml
160
.drone.yml
@ -1,22 +1,148 @@
|
|||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
name: default
|
name: linting
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: ansible-latest
|
- name: ansible-later
|
||||||
image: python:2.7
|
image: xoxys/ansible-later:latest
|
||||||
pull: always
|
commands:
|
||||||
commands:
|
- git clone https://gitea.rknet.org/ansible/ansible-later-policy.git ~/policy
|
||||||
- pip install ansible ansible-later -q
|
- ansible-later -c ~/policy/config.yml
|
||||||
- git clone https://gitea.rknet.org/ansible/ansible-later-policy.git ~/policy
|
environment:
|
||||||
- git ls-files *[^LICENSE,.md] | xargs ansible-later -c ~/policy/config.ini
|
PY_COLORS: 1
|
||||||
depends_on: [ clone ]
|
|
||||||
|
|
||||||
- name: ansible-master
|
trigger:
|
||||||
image: python:2.7
|
ref:
|
||||||
pull: always
|
- refs/heads/master
|
||||||
commands:
|
- "refs/tags/**"
|
||||||
- pip install ansible ansible-later -q
|
- "refs/pull/**"
|
||||||
- git clone https://gitea.rknet.org/ansible/ansible-later-policy.git ~/policy
|
|
||||||
- git ls-files *[^LICENSE,.md] | xargs ansible-later -c ~/policy/config.ini
|
---
|
||||||
depends_on: [ clone ]
|
kind: pipeline
|
||||||
|
name: deployment
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
limit: 1
|
||||||
|
|
||||||
|
workspace:
|
||||||
|
base: /drone/src
|
||||||
|
path: xoxys.vim
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: ansible-molecule
|
||||||
|
image: xoxys/molecule:do-linux-amd64
|
||||||
|
commands:
|
||||||
|
- /bin/bash /docker-entrypoint.sh
|
||||||
|
- molecule test -s default
|
||||||
|
environment:
|
||||||
|
DO_API_KEY:
|
||||||
|
from_secret: do_api_key
|
||||||
|
MOLECULE_CUSTOM_FILTERS_REPO: https://gitea.rknet.org/ansible/custom_filters
|
||||||
|
MOLECULE_CUSTOM_MODULES_REPO: https://gitea.rknet.org/ansible/custom_modules
|
||||||
|
PY_COLORS: 1
|
||||||
|
USER: root
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
ref:
|
||||||
|
- refs/heads/master
|
||||||
|
- "refs/tags/**"
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- linting
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
name: documentation
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: ansible-doctor
|
||||||
|
image: xoxys/ansible-doctor:latest
|
||||||
|
environment:
|
||||||
|
ANSIBLE_DOCTOR_CUSTOM_HEADER: HEADER.md
|
||||||
|
ANSIBLE_DOCTOR_EXCLUDE_FILES: molecule/
|
||||||
|
ANSIBLE_DOCTOR_FORCE_OVERWRITE: true
|
||||||
|
ANSIBLE_DOCTOR_LOG_LEVEL: INFO
|
||||||
|
PY_COLORS: 1
|
||||||
|
|
||||||
|
- name: push-to-repo
|
||||||
|
image: plugins/git-action:latest
|
||||||
|
settings:
|
||||||
|
actions:
|
||||||
|
- commit
|
||||||
|
- push
|
||||||
|
author_email: "shipper@rknet.org"
|
||||||
|
author_name: DroneShipper
|
||||||
|
branch: master
|
||||||
|
message: "[SKIP CI] update readme"
|
||||||
|
netrc_machine: gitea.rknet.org
|
||||||
|
netrc_password:
|
||||||
|
from_secret: gitea_token
|
||||||
|
netrc_username:
|
||||||
|
from_secret: gitea_username
|
||||||
|
remote: https://gitea.rknet.org/ansible/xoxys.vim
|
||||||
|
when:
|
||||||
|
ref:
|
||||||
|
- refs/heads/master
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
ref:
|
||||||
|
- refs/heads/master
|
||||||
|
- "refs/tags/**"
|
||||||
|
- "refs/pull/**"
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- deployment
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
name: notification
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: matrix
|
||||||
|
image: plugins/matrix
|
||||||
|
settings:
|
||||||
|
homeserver:
|
||||||
|
from_secret: matrix_homeserver
|
||||||
|
password:
|
||||||
|
from_secret: matrix_password
|
||||||
|
roomid:
|
||||||
|
from_secret: matrix_roomid
|
||||||
|
template: "Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}"
|
||||||
|
username:
|
||||||
|
from_secret: matrix_username
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
ref:
|
||||||
|
- refs/heads/master
|
||||||
|
- "refs/tags/**"
|
||||||
|
status:
|
||||||
|
- success
|
||||||
|
- failure
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- documentation
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: signature
|
||||||
|
hmac: 698257d0c0befb94de52cb6c06ad0e3036b229e0a5c93f9133471d325fc386fe
|
||||||
|
|
||||||
|
...
|
||||||
|
8
.gitignore
vendored
8
.gitignore
vendored
@ -1,3 +1,11 @@
|
|||||||
# ---> Ansible
|
# ---> Ansible
|
||||||
*.retry
|
*.retry
|
||||||
|
filter/plugins/
|
||||||
|
library
|
||||||
|
|
||||||
|
# ---> Python
|
||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
|
4
HEADER.md
Normal file
4
HEADER.md
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# xoxys.vim
|
||||||
|
|
||||||
|
[![Build Status](https://drone.rknet.org/api/badges/ansible/xoxys.vim/status.svg)](https://drone.rknet.org/ansible/xoxys.vim)
|
||||||
|
|
87
molecule/default/create.yml
Normal file
87
molecule/default/create.yml
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
---
|
||||||
|
- name: Create
|
||||||
|
hosts: localhost
|
||||||
|
connection: local
|
||||||
|
gather_facts: false
|
||||||
|
# no_log: "{{ molecule_no_log }}"
|
||||||
|
vars:
|
||||||
|
ssh_user: root
|
||||||
|
ssh_port: 22
|
||||||
|
|
||||||
|
keypair_name: molecule_key
|
||||||
|
keypair_path: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}/ssh_key"
|
||||||
|
tasks:
|
||||||
|
- name: Create local keypair
|
||||||
|
user:
|
||||||
|
name: "{{ lookup('env', 'USER') }}"
|
||||||
|
generate_ssh_key: true
|
||||||
|
ssh_key_file: "{{ keypair_path }}"
|
||||||
|
register: local_keypair
|
||||||
|
|
||||||
|
- name: Create remote keypair
|
||||||
|
digital_ocean_sshkey:
|
||||||
|
name: "{{ keypair_name }}"
|
||||||
|
ssh_pub_key: "{{ local_keypair.ssh_public_key }}"
|
||||||
|
state: present
|
||||||
|
register: remote_keypair
|
||||||
|
|
||||||
|
- name: Create molecule instance(s)
|
||||||
|
digital_ocean_droplet:
|
||||||
|
name: "{{ item.name }}"
|
||||||
|
unique_name: true
|
||||||
|
region: "{{ item.region_id }}"
|
||||||
|
image: "{{ item.image_id }}"
|
||||||
|
size: "{{ item.size_id }}"
|
||||||
|
ssh_keys: "{{ remote_keypair.data.ssh_key.id }}"
|
||||||
|
wait: true
|
||||||
|
wait_timeout: 300
|
||||||
|
state: present
|
||||||
|
register: server
|
||||||
|
loop: "{{ molecule_yml.platforms }}"
|
||||||
|
async: 7200
|
||||||
|
poll: 0
|
||||||
|
|
||||||
|
- name: Wait for instance(s) creation to complete
|
||||||
|
async_status:
|
||||||
|
jid: "{{ item.ansible_job_id }}"
|
||||||
|
register: digitalocean_jobs
|
||||||
|
until: digitalocean_jobs.finished
|
||||||
|
retries: 300
|
||||||
|
loop: "{{ server.results }}"
|
||||||
|
|
||||||
|
# Mandatory configuration for Molecule to function.
|
||||||
|
|
||||||
|
- name: Populate instance config dict
|
||||||
|
set_fact:
|
||||||
|
instance_conf_dict: {
|
||||||
|
'instance': "{{ item.data.droplet.name }}",
|
||||||
|
'address': "{{ item.data.ip_address }}",
|
||||||
|
'user': "{{ ssh_user }}",
|
||||||
|
'port': "{{ ssh_port }}",
|
||||||
|
'identity_file': "{{ keypair_path }}",
|
||||||
|
'droplet_id': "{{ item.data.droplet.id }}",
|
||||||
|
'ssh_key_id': "{{ remote_keypair.data.ssh_key.id }}",
|
||||||
|
}
|
||||||
|
loop: "{{ digitalocean_jobs.results }}"
|
||||||
|
register: instance_config_dict
|
||||||
|
when: server.changed | bool
|
||||||
|
|
||||||
|
- name: Convert instance config dict to a list
|
||||||
|
set_fact:
|
||||||
|
instance_conf: "{{ instance_config_dict.results | map(attribute='ansible_facts.instance_conf_dict') | list }}"
|
||||||
|
when: server.changed | bool
|
||||||
|
|
||||||
|
- name: Dump instance config
|
||||||
|
copy:
|
||||||
|
content: "{{ instance_conf | to_json | from_json | molecule_to_yaml | molecule_header }}"
|
||||||
|
dest: "{{ molecule_instance_config }}"
|
||||||
|
when: server.changed | bool
|
||||||
|
|
||||||
|
- name: Wait for SSH
|
||||||
|
wait_for:
|
||||||
|
port: "{{ ssh_port }}"
|
||||||
|
host: "{{ item.address }}"
|
||||||
|
search_regex: SSH
|
||||||
|
delay: 10
|
||||||
|
timeout: 320
|
||||||
|
loop: "{{ lookup('file', molecule_instance_config) | molecule_from_yaml }}"
|
54
molecule/default/destroy.yml
Normal file
54
molecule/default/destroy.yml
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
---
|
||||||
|
- name: Destroy
|
||||||
|
hosts: localhost
|
||||||
|
connection: local
|
||||||
|
gather_facts: false
|
||||||
|
no_log: "{{ molecule_no_log }}"
|
||||||
|
tasks:
|
||||||
|
- block:
|
||||||
|
- name: Populate instance config
|
||||||
|
set_fact:
|
||||||
|
instance_conf: "{{ lookup('file', molecule_instance_config) | molecule_from_yaml }}"
|
||||||
|
skip_instances: false
|
||||||
|
rescue:
|
||||||
|
- name: Populate instance config when file missing
|
||||||
|
set_fact:
|
||||||
|
instance_conf: {}
|
||||||
|
skip_instances: true
|
||||||
|
|
||||||
|
- name: Destroy molecule instance(s)
|
||||||
|
digital_ocean_droplet:
|
||||||
|
name: "{{ item.instance }}"
|
||||||
|
id: "{{ item.droplet_id }}"
|
||||||
|
state: absent
|
||||||
|
register: server
|
||||||
|
loop: "{{ instance_conf | flatten(levels=1) }}"
|
||||||
|
when: not skip_instances
|
||||||
|
async: 7200
|
||||||
|
poll: 0
|
||||||
|
|
||||||
|
- name: Wait for instance(s) deletion to complete
|
||||||
|
async_status:
|
||||||
|
jid: "{{ item.ansible_job_id }}"
|
||||||
|
register: digitalocean_jobs
|
||||||
|
until: digitalocean_jobs.finished
|
||||||
|
retries: 300
|
||||||
|
loop: "{{ server.results }}"
|
||||||
|
|
||||||
|
- name: Delete remote keypair
|
||||||
|
digital_ocean_sshkey:
|
||||||
|
fingerprint: "{{ item.ssh_key_id }}"
|
||||||
|
state: absent
|
||||||
|
loop: "{{ instance_conf | flatten(levels=1) }}"
|
||||||
|
|
||||||
|
# Mandatory configuration for Molecule to function.
|
||||||
|
|
||||||
|
- name: Populate instance config
|
||||||
|
set_fact:
|
||||||
|
instance_conf: {}
|
||||||
|
|
||||||
|
- name: Dump instance config
|
||||||
|
copy:
|
||||||
|
content: "{{ instance_conf | molecule_to_yaml | molecule_header }}"
|
||||||
|
dest: "{{ molecule_instance_config }}"
|
||||||
|
when: server.changed | bool
|
22
molecule/default/molecule.yml
Normal file
22
molecule/default/molecule.yml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
dependency:
|
||||||
|
name: galaxy
|
||||||
|
driver:
|
||||||
|
name: digitalocean
|
||||||
|
platforms:
|
||||||
|
- name: centos7-vim
|
||||||
|
region_id: fra1
|
||||||
|
image_id: centos-7-x64
|
||||||
|
size_id: s-1vcpu-1gb
|
||||||
|
lint:
|
||||||
|
name: yamllint
|
||||||
|
enabled: False
|
||||||
|
provisioner:
|
||||||
|
name: ansible
|
||||||
|
lint:
|
||||||
|
name: ansible-lint
|
||||||
|
enabled: False
|
||||||
|
verifier:
|
||||||
|
name: testinfra
|
||||||
|
lint:
|
||||||
|
name: flake8
|
5
molecule/default/playbook.yml
Normal file
5
molecule/default/playbook.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- name: Converge
|
||||||
|
hosts: all
|
||||||
|
roles:
|
||||||
|
- role: xoxys.vim
|
9
molecule/default/prepare.yml
Normal file
9
molecule/default/prepare.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
- name: Prepare
|
||||||
|
hosts: all
|
||||||
|
gather_facts: false
|
||||||
|
tasks:
|
||||||
|
- name: Install python for Ansible
|
||||||
|
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
|
||||||
|
become: true
|
||||||
|
changed_when: false
|
14
molecule/default/tests/test_default.py
Normal file
14
molecule/default/tests/test_default.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
import testinfra.utils.ansible_runner
|
||||||
|
|
||||||
|
import warnings
|
||||||
|
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
||||||
|
|
||||||
|
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
||||||
|
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
||||||
|
|
||||||
|
|
||||||
|
def test_vim_is_installed(host):
|
||||||
|
vim = host.package("vim-enhanced")
|
||||||
|
assert vim.is_installed
|
3
molecule/pytest.ini
Normal file
3
molecule/pytest.ini
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[pytest]
|
||||||
|
filterwarnings =
|
||||||
|
ignore::DeprecationWarning
|
10
tasks/configure_debian.yml
Normal file
10
tasks/configure_debian.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
- name: Fix default vim (debian)
|
||||||
|
lineinfile:
|
||||||
|
dest: /etc/vim/vimrc
|
||||||
|
regexp: '^\"\s*let\sg\:skip_defaults_vim.*$'
|
||||||
|
line: 'let g:skip_defaults_vim = 1'
|
||||||
|
state: present
|
||||||
|
backrefs: yes
|
||||||
|
become: True
|
||||||
|
become_user: root
|
11
tasks/configure_redhat.yml
Normal file
11
tasks/configure_redhat.yml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
- name: Source local vimrc (redhat)
|
||||||
|
blockinfile:
|
||||||
|
dest: /etc/vimrc
|
||||||
|
marker: "\" {mark} ANSIBLE MANAGED BLOCK"
|
||||||
|
block: |
|
||||||
|
if filereadable("/etc/vim/vimrc.local")
|
||||||
|
source /etc/vim/vimrc.local
|
||||||
|
endif
|
||||||
|
become: True
|
||||||
|
become_user: root
|
@ -1,4 +1,13 @@
|
|||||||
---
|
---
|
||||||
- include_vars: "os_{{ ansible_os_family | lower }}.yml"
|
- include_vars: "{{ ansible_os_family | lower }}.yml"
|
||||||
|
|
||||||
- import_tasks: setup.yml
|
- import_tasks: setup.yml
|
||||||
|
|
||||||
|
- include_tasks: "{{ lookup('first_found', params) }}"
|
||||||
|
vars:
|
||||||
|
params:
|
||||||
|
files:
|
||||||
|
- "configure_{{ ansible_os_family | lower }}.yml"
|
||||||
|
paths:
|
||||||
|
- "tasks"
|
||||||
|
errors: "ignore"
|
||||||
|
@ -20,24 +20,5 @@
|
|||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
|
||||||
- name: Fix default vim (debian)
|
|
||||||
lineinfile:
|
|
||||||
dest: /etc/vim/vimrc
|
|
||||||
regexp: '^\"\s*let\sg\:skip_defaults_vim.*$'
|
|
||||||
line: 'let g:skip_defaults_vim = 1'
|
|
||||||
state: present
|
|
||||||
backrefs: yes
|
|
||||||
when: ansible_os_family == "Debian"
|
|
||||||
|
|
||||||
- name: Source local vimrc (redhat)
|
|
||||||
blockinfile:
|
|
||||||
dest: /etc/vimrc
|
|
||||||
marker: "\" {mark} ANSIBLE MANAGED BLOCK"
|
|
||||||
block: |
|
|
||||||
if filereadable("/etc/vim/vimrc.local")
|
|
||||||
source /etc/vim/vimrc.local
|
|
||||||
endif
|
|
||||||
when: ansible_os_family == "RedHat"
|
|
||||||
become: True
|
become: True
|
||||||
become_user: root
|
become_user: root
|
||||||
|
Loading…
Reference in New Issue
Block a user