Browse Source

Working for Ubuntu

Jeroen De Meerleer 2 years ago
parent
commit
20a2210eb9
9 changed files with 100 additions and 0 deletions
  1. 3 0
      defaults/main.yml
  2. 7 0
      handlers/main.yml
  3. 57 0
      meta/main.yml
  4. 5 0
      tasks/main.yml
  5. 12 0
      tasks/tasks-Debian.yml
  6. 7 0
      templates/ubuntu.j2
  7. 2 0
      tests/inventory
  8. 5 0
      tests/test.yml
  9. 2 0
      vars/main.yml

+ 3 - 0
defaults/main.yml

@@ -0,0 +1,3 @@
+---
+# defaults file for ansible-role-ipv6
+

+ 7 - 0
handlers/main.yml

@@ -0,0 +1,7 @@
+---
+# handlers file for ansible-role-ipv6
+
+- name: restart network
+  service:
+    name: "networking"
+    state: "restarted"

+ 57 - 0
meta/main.yml

@@ -0,0 +1,57 @@
+galaxy_info:
+  author: your name
+  description: your description
+  company: your company (optional)
+
+  # If the issue tracker for your role is not on github, uncomment the
+  # next line and provide a value
+  # issue_tracker_url: http://example.com/issue/tracker
+
+  # Some suggested licenses:
+  # - BSD (default)
+  # - MIT
+  # - GPLv2
+  # - GPLv3
+  # - Apache
+  # - CC-BY
+  license: license (GPLv2, CC-BY, etc)
+
+  min_ansible_version: 1.2
+
+  # If this a Container Enabled role, provide the minimum Ansible Container version.
+  # min_ansible_container_version:
+
+  # Optionally specify the branch Galaxy will use when accessing the GitHub
+  # repo for this role. During role install, if no tags are available,
+  # Galaxy will use this branch. During import Galaxy will access files on
+  # this branch. If Travis integration is configured, only notifications for this
+  # branch will be accepted. Otherwise, in all cases, the repo's default branch
+  # (usually master) will be used.
+  #github_branch:
+
+  #
+  # platforms is a list of platforms, and each platform has a name and a list of versions.
+  #
+  # platforms:
+  # - name: Fedora
+  #   versions:
+  #   - all
+  #   - 25
+  # - name: SomePlatform
+  #   versions:
+  #   - all
+  #   - 1.0
+  #   - 7
+  #   - 99.99
+
+  galaxy_tags: []
+    # List tags for your role here, one per line. A tag is a keyword that describes
+    # and categorizes the role. Users find roles by searching for tags. Be sure to
+    # remove the '[]' above, if you add tags to this list.
+    #
+    # NOTE: A tag is limited to a single word comprised of alphanumeric characters.
+    #       Maximum 20 tags per role.
+
+dependencies: []
+  # List your role dependencies here, one per line. Be sure to remove the '[]' above,
+  # if you add dependencies to this list.

+ 5 - 0
tasks/main.yml

@@ -0,0 +1,5 @@
+---
+# tasks file for ansible-role-ipv6
+
+- include: "tasks-{{ ansible_os_family }}.yml"
+  static: no

+ 12 - 0
tasks/tasks-Debian.yml

@@ -0,0 +1,12 @@
+---
+# Configure IPv6 on ubuntu
+
+- name: Configure IPv6
+  template:
+    src: "ubuntu.j2"
+    dest: "/etc/network/interfaces.d/10-ipv6"
+    owner: root
+    group: root
+    mode: 0644
+  notify: restart network
+  when: ipv6_interface is defined

+ 7 - 0
templates/ubuntu.j2

@@ -0,0 +1,7 @@
+iface {{ ipv6_interface }} inet6 static
+address {{ ipv6_address }}
+netmask {{ ipv6_netmask }}
+post-up /sbin/ip -6 route add {{ ipv6_gateway }} dev {{ ipv6_interface }}
+post-up /sbin/ip -6 route add default via {{ ipv6_gateway }} dev {{ ipv6_interface }}
+pre-down /sbin/ip -6 route del default via {{ ipv6_gateway }} dev {{ ipv6_interface }}
+pre-down /sbin/ip -6 route del {{ ipv6_gateway }} dev {{ ipv6_interface }}

+ 2 - 0
tests/inventory

@@ -0,0 +1,2 @@
+localhost
+

+ 5 - 0
tests/test.yml

@@ -0,0 +1,5 @@
+---
+- hosts: localhost
+  remote_user: root
+  roles:
+    - ansible-role-ipv6

+ 2 - 0
vars/main.yml

@@ -0,0 +1,2 @@
+---
+# vars file for ansible-role-ipv6