Browse Source

initial commit

drymer 2 years ago
commit
b0330b729c

+ 2
- 0
.gitignore View File

@@ -0,0 +1,2 @@
1
+*.pyc
2
+*cache*

+ 4
- 0
.yamllint View File

@@ -0,0 +1,4 @@
1
+extends: relaxed
2
+truthy: disable
3
+rules: {line-length: {max: 130}}
4
+

+ 44
- 0
README.md View File

@@ -0,0 +1,44 @@
1
+Fonts
2
+=========
3
+
4
+Install powerline-fonts and fonts awesome.
5
+
6
+Requirements
7
+------------
8
+
9
+None.
10
+
11
+Role Variables
12
+--------------
13
+
14
+* `install_dir`: Where to clone the powerline font.
15
+
16
+Dependencies
17
+------------
18
+
19
+None.
20
+
21
+Example Playbook
22
+----------------
23
+
24
+```yaml
25
+- hosts: servers
26
+  roles:
27
+    - { role: docker, install_dir: ~/Instalados }
28
+```
29
+
30
+Compatible
31
+----------
32
+
33
+With:
34
+  - Debian 9
35
+
36
+License
37
+-------
38
+
39
+GPL3
40
+
41
+Author Information
42
+------------------
43
+
44
+drymer [ EN ] autistici.org

+ 3
- 0
defaults/main.yml View File

@@ -0,0 +1,3 @@
1
+---
2
+install_dir:
3
+powerline_commit: 6ac4c01

+ 7
- 0
molecule/default/Dockerfile.j2 View File

@@ -0,0 +1,7 @@
1
+FROM {{ item.image }}
2
+
3
+RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
4
+    elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python python-devel python2-dnf bash && dnf clean all; \
5
+    elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
6
+    elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
7
+    elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; fi

+ 46
- 0
molecule/default/INSTALL.rst View File

@@ -0,0 +1,46 @@
1
+*******
2
+Install
3
+*******
4
+
5
+This set of playbooks have specific dependencies on Ansible due to the modules
6
+being used.
7
+
8
+Requirements
9
+============
10
+
11
+* Ansible 2.2
12
+* Docker Engine
13
+* docker-py
14
+
15
+Install OS dependencies on CentOS 7
16
+
17
+.. code-block:: bash
18
+
19
+  $ sudo yum install -y epel-release
20
+  $ sudo yum install -y gcc python-pip python-devel openssl-devel
21
+  # If installing Molecule from source.
22
+  $ sudo yum install libffi-devel git
23
+
24
+Install OS dependencies on Ubuntu 16.x
25
+
26
+.. code-block:: bash
27
+
28
+  $ sudo apt-get update
29
+  $ sudo apt-get install -y python-pip libssl-dev docker-engine
30
+  # If installing Molecule from source.
31
+  $ sudo apt-get install -y libffi-dev git
32
+
33
+Install OS dependencies on Mac OS
34
+
35
+.. code-block:: bash
36
+
37
+  $ brew install python
38
+  $ brew install git
39
+
40
+Install using pip:
41
+
42
+.. code-block:: bash
43
+
44
+  $ sudo pip install ansible
45
+  $ sudo pip install docker-py
46
+  $ sudo pip install molecule --pre

+ 47
- 0
molecule/default/create.yml View File

@@ -0,0 +1,47 @@
1
+---
2
+- name: Create
3
+  hosts: localhost
4
+  connection: local
5
+  gather_facts: False
6
+  no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}"
7
+  vars:
8
+    molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}"
9
+    molecule_ephemeral_directory: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}"
10
+    molecule_scenario_directory: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}"
11
+    molecule_yml: "{{ lookup('file', molecule_file) | from_yaml }}"
12
+  tasks:
13
+    - name: Create Dockerfiles from image names
14
+      template:
15
+        src: "{{ molecule_scenario_directory }}/Dockerfile.j2"
16
+        dest: "{{ molecule_ephemeral_directory }}/Dockerfile_{{ item.image | regex_replace('[^a-zA-Z0-9_]', '_') }}"
17
+      with_items: "{{ molecule_yml.platforms }}"
18
+      register: platforms
19
+
20
+    - name: Discover local Docker images
21
+      docker_image_facts:
22
+        name: "molecule_local/{{ item.item.name }}"
23
+      with_items: "{{ platforms.results }}"
24
+      register: docker_images
25
+
26
+    - name: Build an Ansible compatible image
27
+      docker_image:
28
+        path: "{{ molecule_ephemeral_directory }}"
29
+        name: "molecule_local/{{ item.item.image }}"
30
+        dockerfile: "{{ item.item.dockerfile | default(item.invocation.module_args.dest) }}"
31
+        force: "{{ item.item.force | default(True) }}"
32
+      with_items: "{{ platforms.results }}"
33
+      when: platforms.changed or docker_images.results | map(attribute='images') | select('equalto', []) | list | count >= 0
34
+
35
+    - name: Create molecule instance(s)
36
+      docker_container:
37
+        name: "{{ item.name }}"
38
+        hostname: "{{ item.name }}"
39
+        image: "molecule_local/{{ item.image }}"
40
+        state: started
41
+        recreate: False
42
+        log_driver: syslog
43
+        command: "{{ item.command | default('sleep infinity') }}"
44
+        privileged: "{{ item.privileged | default(omit) }}"
45
+        volumes: "{{ item.volumes | default(omit) }}"
46
+        capabilities: "{{ item.capabilities | default(omit) }}"
47
+      with_items: "{{ molecule_yml.platforms }}"

+ 16
- 0
molecule/default/destroy.yml View File

@@ -0,0 +1,16 @@
1
+---
2
+- name: Destroy
3
+  hosts: localhost
4
+  connection: local
5
+  gather_facts: False
6
+  no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}"
7
+  vars:
8
+    molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}"
9
+    molecule_yml: "{{ lookup('file', molecule_file) | from_yaml }}"
10
+  tasks:
11
+    - name: Destroy molecule instance(s)
12
+      docker_container:
13
+        name: "{{ item.name }}"
14
+        state: absent
15
+        force_kill: "{{ item.force_kill | default(True) }}"
16
+      with_items: "{{ molecule_yml.platforms }}"

+ 26
- 0
molecule/default/molecule.yml View File

@@ -0,0 +1,26 @@
1
+---
2
+dependency:
3
+  name: galaxy
4
+driver:
5
+  name: docker
6
+lint:
7
+  name: yamllint
8
+platforms:
9
+  - name: geerlingguy_docker_debian9_ansible
10
+    image: geerlingguy/docker-debian9-ansible
11
+    privileged: True
12
+    volumes:
13
+      - /sys/fs/cgroup:/sys/fs/cgroup:ro
14
+    command: /lib/systemd/systemd
15
+provisioner:
16
+  name: ansible
17
+  lint:
18
+    name: ansible-lint
19
+  options:
20
+    extra-vars: force_docker=yes
21
+scenario:
22
+  name: default
23
+verifier:
24
+  name: testinfra
25
+  lint:
26
+    name: flake8

+ 7
- 0
molecule/default/playbook.yml View File

@@ -0,0 +1,7 @@
1
+---
2
+- name: Converge
3
+  hosts: all
4
+  vars:
5
+    install_dir: "~/Instalados/"
6
+  roles:
7
+    - role: fonts

+ 1
- 0
molecule/default/tests/.#test_default.py View File

@@ -0,0 +1 @@
1
+drymer@equilibry.7057:1507136054

+ 24
- 0
molecule/default/tests/test_default.py View File

@@ -0,0 +1,24 @@
1
+import os
2
+
3
+import testinfra.utils.ansible_runner
4
+
5
+testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
6
+    os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
7
+
8
+
9
+def test_font_file(host):
10
+    f = host.file('/root/.local/share/fonts/DejaVuSansMono')
11
+
12
+    assert f.is_symlink
13
+
14
+
15
+buenas
16
+no podre dedicarle tiempo hasta la tarde si eso
17
+pero
18
+He cambiado el servicio reverse-proxy por el de nginx.
19
+He cambiado los nombres de los ficheros de vhost por el de sus dominios.
20
+He actualizado docker y ha tirado el gitea. El servicio que tiene no es valido.
21
+respecto lo ultimo, que lo hice medio dormido, no tiró gitea tiró todos los contenedores
22
+pero como gitea no tiene un servicio de systemd, pues eso, que no sabia como relevantarlo
23
+y el prosody hay que llevarlo a la red interna para poder hacer el proxy inverso para el http upload, lo que pasa es que
24
+acer un grant de la ip origen al mysql

+ 43
- 0
tasks/main.yml View File

@@ -0,0 +1,43 @@
1
+---
2
+# tasks file for fonts
3
+- name: Install Awsome Font and fontconfig
4
+  become: yes
5
+  apt:
6
+    name: "{{ item }}"
7
+    state: present
8
+  with_items:
9
+    - fontconfig
10
+    - fonts-font-awesome
11
+
12
+- name: Install dependencies
13
+  become: yes
14
+  apt:
15
+    name: git
16
+    state: present
17
+
18
+- name: Clone powerline patched fonts
19
+  git:
20
+    repo: "https://github.com/powerline/fonts"
21
+    dest: "{{ install_dir }}/powerline-fonts/"
22
+    version: "{{ powerline_commit }}"
23
+  register: cloned
24
+
25
+- name: Create $HOME/.local/share
26
+  file:
27
+    path: ~/.local/share/fonts
28
+    state: directory
29
+
30
+- name: Link the fonts directory
31
+  file:
32
+    src: "{{ install_dir }}/powerline-fonts/DejaVuSansMono"
33
+    dest: ~/.local/share/fonts/DejaVuSansMono
34
+    state: link
35
+  when: cloned.changed
36
+  tags:
37
+    - skip_ansible_lint
38
+
39
+- name: Cache all the fonts
40
+  shell: fc-cache -fv ~/.local/share/fonts/
41
+  when: cloned.changed
42
+  tags:
43
+    - skip_ansible_lint

Loading…
Cancel
Save