Browse Source

first commit

Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
changes/35/554335/1
Kevin Carter 1 year ago
commit
dd82b31ee2
No account linked to committer's email address

+ 68
- 0
.gitignore View File

@@ -0,0 +1,68 @@
1
+# Compiled source #
2
+###################
3
+*.com
4
+*.class
5
+*.dll
6
+*.exe
7
+*.o
8
+*.so
9
+*.pyc
10
+build/
11
+dist/
12
+doc/build/
13
+
14
+# Packages #
15
+############
16
+# it's better to unpack these files and commit the raw source
17
+# git has its own built in compression methods
18
+*.7z
19
+*.dmg
20
+*.gz
21
+*.iso
22
+*.jar
23
+*.rar
24
+*.tar
25
+*.zip
26
+
27
+# Logs and databases #
28
+######################
29
+*.log
30
+*.sql
31
+*.sqlite
32
+logs/*
33
+
34
+# OS generated files #
35
+######################
36
+.DS_Store
37
+.DS_Store?
38
+._*
39
+.Spotlight-V100
40
+.Trashes
41
+.idea
42
+.tox
43
+*.sublime*
44
+*.egg-info
45
+Icon?
46
+ehthumbs.db
47
+Thumbs.db
48
+.eggs
49
+
50
+# User driven backup files #
51
+############################
52
+*.bak
53
+*.swp
54
+
55
+# Generated by pbr while building docs
56
+######################################
57
+AUTHORS
58
+ChangeLog
59
+
60
+# Files created by releasenotes build
61
+releasenotes/build
62
+
63
+# Test temp files
64
+tests/common
65
+tests/*.retry
66
+
67
+# Vagrant artifacts
68
+.vagrant

+ 4
- 0
.gitreview View File

@@ -0,0 +1,4 @@
1
+[gerrit]
2
+host=review.openstack.org
3
+port=29418
4
+project=openstack/ansible-systemd_init.git

+ 85
- 0
CONTRIBUTING.rst View File

@@ -0,0 +1,85 @@
1
+systemd_networkd
2
+############
3
+:tags: openstack, cloud, ansible
4
+:category: \*nix
5
+
6
+contributor guidelines
7
+^^^^^^^^^^^^^^^^^^^^^^
8
+
9
+Filing Bugs
10
+-----------
11
+
12
+Bugs should be filed on Launchpad, not GitHub: "https://bugs.launchpad.net/openstack-ansible"
13
+
14
+
15
+When submitting a bug, or working on a bug, please ensure the following criteria are met:
16
+    * The description clearly states or describes the original problem or root cause of the problem.
17
+    * Include historical information on how the problem was identified.
18
+    * Any relevant logs are included.
19
+    * The provided information should be totally self-contained. External access to web services/sites should not be needed.
20
+    * Steps to reproduce the problem if possible.
21
+
22
+
23
+Submitting Code
24
+---------------
25
+
26
+Changes to the project should be submitted for review via the Gerrit tool, following
27
+the workflow documented at: "http://docs.openstack.org/infra/manual/developers.html#development-workflow"
28
+
29
+Pull requests submitted through GitHub will be ignored and closed without regard.
30
+
31
+
32
+Extra
33
+-----
34
+
35
+Tags:
36
+    If it's a bug that needs fixing in a branch in addition to Master, add a '\<release\>-backport-potential' tag (eg ``juno-backport-potential``).  There are predefined tags that will autocomplete.
37
+
38
+Status:
39
+    Please leave this alone, it should be New till someone triages the issue.
40
+
41
+Importance:
42
+    Should only be touched if it is a Blocker/Gating issue. If it is, please set to High, and only use Critical if you have found a bug that can take down whole infrastructures.
43
+
44
+
45
+Style guide
46
+-----------
47
+
48
+When creating tasks and other roles for use in Ansible please create then using the YAML dictionary format.
49
+
50
+Example YAML dictionary format:
51
+    .. code-block:: yaml
52
+
53
+        - name: The name of the tasks
54
+          module_name:
55
+            thing1: "some-stuff"
56
+            thing2: "some-other-stuff"
57
+          tags:
58
+            - some-tag
59
+            - some-other-tag
60
+
61
+
62
+Example **NOT** in YAML dictionary format:
63
+    .. code-block:: yaml
64
+
65
+        - name: The name of the tasks
66
+          module_name: thing1="some-stuff" thing2="some-other-stuff"
67
+          tags:
68
+            - some-tag
69
+            - some-other-tag
70
+
71
+
72
+Usage of the ">" and "|" operators should be limited to Ansible conditionals and command modules such as the ansible ``shell`` module.
73
+
74
+
75
+Issues
76
+------
77
+
78
+When submitting an issue, or working on an issue please ensure the following criteria are met:
79
+    * The description clearly states or describes the original problem or root cause of the problem.
80
+    * Include historical information on how the problem was identified.
81
+    * Any relevant logs are included.
82
+    * If the issue is a bug that needs fixing in a branch other than Master, add the ‘backport potential’ tag TO THE ISSUE (not the PR).
83
+    * The provided information should be totally self-contained. External access to web services/sites should not be needed.
84
+    * If the issue is needed for a hotfix release, add the 'expedite' label.
85
+    * Steps to reproduce the problem if possible.

+ 202
- 0
LICENSE View File

@@ -0,0 +1,202 @@
1
+                                 Apache License
2
+                           Version 2.0, January 2004
3
+                        http://www.apache.org/licenses/
4
+
5
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+   1. Definitions.
8
+
9
+      "License" shall mean the terms and conditions for use, reproduction,
10
+      and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+      "Licensor" shall mean the copyright owner or entity authorized by
13
+      the copyright owner that is granting the License.
14
+
15
+      "Legal Entity" shall mean the union of the acting entity and all
16
+      other entities that control, are controlled by, or are under common
17
+      control with that entity. For the purposes of this definition,
18
+      "control" means (i) the power, direct or indirect, to cause the
19
+      direction or management of such entity, whether by contract or
20
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+      outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+      "You" (or "Your") shall mean an individual or Legal Entity
24
+      exercising permissions granted by this License.
25
+
26
+      "Source" form shall mean the preferred form for making modifications,
27
+      including but not limited to software source code, documentation
28
+      source, and configuration files.
29
+
30
+      "Object" form shall mean any form resulting from mechanical
31
+      transformation or translation of a Source form, including but
32
+      not limited to compiled object code, generated documentation,
33
+      and conversions to other media types.
34
+
35
+      "Work" shall mean the work of authorship, whether in Source or
36
+      Object form, made available under the License, as indicated by a
37
+      copyright notice that is included in or attached to the work
38
+      (an example is provided in the Appendix below).
39
+
40
+      "Derivative Works" shall mean any work, whether in Source or Object
41
+      form, that is based on (or derived from) the Work and for which the
42
+      editorial revisions, annotations, elaborations, or other modifications
43
+      represent, as a whole, an original work of authorship. For the purposes
44
+      of this License, Derivative Works shall not include works that remain
45
+      separable from, or merely link (or bind by name) to the interfaces of,
46
+      the Work and Derivative Works thereof.
47
+
48
+      "Contribution" shall mean any work of authorship, including
49
+      the original version of the Work and any modifications or additions
50
+      to that Work or Derivative Works thereof, that is intentionally
51
+      submitted to Licensor for inclusion in the Work by the copyright owner
52
+      or by an individual or Legal Entity authorized to submit on behalf of
53
+      the copyright owner. For the purposes of this definition, "submitted"
54
+      means any form of electronic, verbal, or written communication sent
55
+      to the Licensor or its representatives, including but not limited to
56
+      communication on electronic mailing lists, source code control systems,
57
+      and issue tracking systems that are managed by, or on behalf of, the
58
+      Licensor for the purpose of discussing and improving the Work, but
59
+      excluding communication that is conspicuously marked or otherwise
60
+      designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+      "Contributor" shall mean Licensor and any individual or Legal Entity
63
+      on behalf of whom a Contribution has been received by Licensor and
64
+      subsequently incorporated within the Work.
65
+
66
+   2. Grant of Copyright License. Subject to the terms and conditions of
67
+      this License, each Contributor hereby grants to You a perpetual,
68
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+      copyright license to reproduce, prepare Derivative Works of,
70
+      publicly display, publicly perform, sublicense, and distribute the
71
+      Work and such Derivative Works in Source or Object form.
72
+
73
+   3. Grant of Patent License. Subject to the terms and conditions of
74
+      this License, each Contributor hereby grants to You a perpetual,
75
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+      (except as stated in this section) patent license to make, have made,
77
+      use, offer to sell, sell, import, and otherwise transfer the Work,
78
+      where such license applies only to those patent claims licensable
79
+      by such Contributor that are necessarily infringed by their
80
+      Contribution(s) alone or by combination of their Contribution(s)
81
+      with the Work to which such Contribution(s) was submitted. If You
82
+      institute patent litigation against any entity (including a
83
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+      or a Contribution incorporated within the Work constitutes direct
85
+      or contributory patent infringement, then any patent licenses
86
+      granted to You under this License for that Work shall terminate
87
+      as of the date such litigation is filed.
88
+
89
+   4. Redistribution. You may reproduce and distribute copies of the
90
+      Work or Derivative Works thereof in any medium, with or without
91
+      modifications, and in Source or Object form, provided that You
92
+      meet the following conditions:
93
+
94
+      (a) You must give any other recipients of the Work or
95
+          Derivative Works a copy of this License; and
96
+
97
+      (b) You must cause any modified files to carry prominent notices
98
+          stating that You changed the files; and
99
+
100
+      (c) You must retain, in the Source form of any Derivative Works
101
+          that You distribute, all copyright, patent, trademark, and
102
+          attribution notices from the Source form of the Work,
103
+          excluding those notices that do not pertain to any part of
104
+          the Derivative Works; and
105
+
106
+      (d) If the Work includes a "NOTICE" text file as part of its
107
+          distribution, then any Derivative Works that You distribute must
108
+          include a readable copy of the attribution notices contained
109
+          within such NOTICE file, excluding those notices that do not
110
+          pertain to any part of the Derivative Works, in at least one
111
+          of the following places: within a NOTICE text file distributed
112
+          as part of the Derivative Works; within the Source form or
113
+          documentation, if provided along with the Derivative Works; or,
114
+          within a display generated by the Derivative Works, if and
115
+          wherever such third-party notices normally appear. The contents
116
+          of the NOTICE file are for informational purposes only and
117
+          do not modify the License. You may add Your own attribution
118
+          notices within Derivative Works that You distribute, alongside
119
+          or as an addendum to the NOTICE text from the Work, provided
120
+          that such additional attribution notices cannot be construed
121
+          as modifying the License.
122
+
123
+      You may add Your own copyright statement to Your modifications and
124
+      may provide additional or different license terms and conditions
125
+      for use, reproduction, or distribution of Your modifications, or
126
+      for any such Derivative Works as a whole, provided Your use,
127
+      reproduction, and distribution of the Work otherwise complies with
128
+      the conditions stated in this License.
129
+
130
+   5. Submission of Contributions. Unless You explicitly state otherwise,
131
+      any Contribution intentionally submitted for inclusion in the Work
132
+      by You to the Licensor shall be under the terms and conditions of
133
+      this License, without any additional terms or conditions.
134
+      Notwithstanding the above, nothing herein shall supersede or modify
135
+      the terms of any separate license agreement you may have executed
136
+      with Licensor regarding such Contributions.
137
+
138
+   6. Trademarks. This License does not grant permission to use the trade
139
+      names, trademarks, service marks, or product names of the Licensor,
140
+      except as required for reasonable and customary use in describing the
141
+      origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+   7. Disclaimer of Warranty. Unless required by applicable law or
144
+      agreed to in writing, Licensor provides the Work (and each
145
+      Contributor provides its Contributions) on an "AS IS" BASIS,
146
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+      implied, including, without limitation, any warranties or conditions
148
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+      PARTICULAR PURPOSE. You are solely responsible for determining the
150
+      appropriateness of using or redistributing the Work and assume any
151
+      risks associated with Your exercise of permissions under this License.
152
+
153
+   8. Limitation of Liability. In no event and under no legal theory,
154
+      whether in tort (including negligence), contract, or otherwise,
155
+      unless required by applicable law (such as deliberate and grossly
156
+      negligent acts) or agreed to in writing, shall any Contributor be
157
+      liable to You for damages, including any direct, indirect, special,
158
+      incidental, or consequential damages of any character arising as a
159
+      result of this License or out of the use or inability to use the
160
+      Work (including but not limited to damages for loss of goodwill,
161
+      work stoppage, computer failure or malfunction, or any and all
162
+      other commercial damages or losses), even if such Contributor
163
+      has been advised of the possibility of such damages.
164
+
165
+   9. Accepting Warranty or Additional Liability. While redistributing
166
+      the Work or Derivative Works thereof, You may choose to offer,
167
+      and charge a fee for, acceptance of support, warranty, indemnity,
168
+      or other liability obligations and/or rights consistent with this
169
+      License. However, in accepting such obligations, You may act only
170
+      on Your own behalf and on Your sole responsibility, not on behalf
171
+      of any other Contributor, and only if You agree to indemnify,
172
+      defend, and hold each Contributor harmless for any liability
173
+      incurred by, or claims asserted against, such Contributor by reason
174
+      of your accepting any such warranty or additional liability.
175
+
176
+   END OF TERMS AND CONDITIONS
177
+
178
+   APPENDIX: How to apply the Apache License to your work.
179
+
180
+      To apply the Apache License to your work, attach the following
181
+      boilerplate notice, with the fields enclosed by brackets "{}"
182
+      replaced with your own identifying information. (Don't include
183
+      the brackets!)  The text should be enclosed in the appropriate
184
+      comment syntax for the file format. We also recommend that a
185
+      file or class name and description of purpose be included on the
186
+      same "printed page" as the copyright notice for easier
187
+      identification within third-party archives.
188
+
189
+   Copyright {yyyy} {name of copyright owner}
190
+
191
+   Licensed under the Apache License, Version 2.0 (the "License");
192
+   you may not use this file except in compliance with the License.
193
+   You may obtain a copy of the License at
194
+
195
+       http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+   Unless required by applicable law or agreed to in writing, software
198
+   distributed under the License is distributed on an "AS IS" BASIS,
199
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+   See the License for the specific language governing permissions and
201
+   limitations under the License.
202
+

+ 72
- 0
README.md View File

@@ -0,0 +1,72 @@
1
+#### Ansible systemd_networkd
2
+
3
+This Ansible role configures systemd-networkd link, network, and netdev files.
4
+
5
+This role requires the ``openstack-ansible-plugins`` repository to be available
6
+on your local system. The Ansible galaxy resolver will not retrieve this role
7
+for you. To get the plugins role in place clone the plugins repository
8
+**before** running this role.
9
+
10
+``` bash
11
+# git clone https://github.com/openstack/openstack-ansible-plugins /etc/ansible/roles/plugins
12
+```
13
+
14
+You can also use the ``ansible-galaxy`` command on the ``ansible-role-requirements.yml`` file.
15
+
16
+``` bash
17
+# ansible-galaxy install -r ansible-role-requirements.yml
18
+```
19
+
20
+----
21
+
22
+###### Example playbook
23
+
24
+> See the "defaults.yml" file for a full list of all available options.
25
+
26
+``` yaml
27
+- name: Create a systemd-networkd interfaces
28
+  hosts: localhost
29
+  become: true
30
+  roles:
31
+    - role: "systemd_networkd"
32
+      systemd_netdevs:
33
+        - NetDev:
34
+            Name: dummy0
35
+            Kind: dummy
36
+        - NetDev:
37
+            Name: dummy1
38
+            Kind: dummy
39
+        - NetDev:
40
+            Name: bond0
41
+            Kind: bond
42
+          Bond:
43
+            Mode: 802.3ad
44
+            TransmitHashPolicy: layer3+4
45
+            MIIMonitorSec: 1s
46
+            LACPTransmitRate: fast
47
+        - NetDev:
48
+            Name: br-dummy
49
+            Kind: bridge
50
+      systemd_networks:
51
+        - interface: "dummy0"
52
+          bond: "bond0"
53
+          mtu: 9000
54
+        - interface: "dummy1"
55
+          bond: "bond0"
56
+          mtu: 9000
57
+        - interface: "bond0"
58
+          bridge: "br-dummy"
59
+          mtu: 9000
60
+        - interface: "br-dummy"
61
+          address: "10.0.0.100"
62
+          netmask: "255.255.255.0"
63
+          gateway: "10.0.0.1"
64
+          mtu: 9000
65
+          usedns: true
66
+          static_routes:
67
+            - gateway: "10.1.0.1"
68
+              cidr: "10.1.0.0/24"
69
+          config_overrides:
70
+            Network:
71
+              ConfigureWithoutCarrier: true
72
+```

+ 12
- 0
Vagrantfile View File

@@ -0,0 +1,12 @@
1
+Vagrant.configure(2) do |config|
2
+  config.vm.box = "ubuntu/xenial64"
3
+  config.vm.provider "virtualbox" do |v|
4
+    v.memory = 2048
5
+    v.cpus = 2
6
+  end
7
+  config.vm.provision "shell", inline: <<-SHELL
8
+    sudo su -
9
+    cd /vagrant
10
+    ./run_tests.sh
11
+  SHELL
12
+end

+ 4
- 0
ansible-role-requirements.yaml View File

@@ -0,0 +1,4 @@
1
+- name: "plugins"
2
+  src: "https://git.openstack.org/openstack/openstack-ansible-plugins"
3
+  scm: git
4
+  version: "master"

+ 41
- 0
bindep.txt View File

@@ -0,0 +1,41 @@
1
+# This file facilitates OpenStack-CI package installation
2
+# before the execution of any tests.
3
+#
4
+# See the following for details:
5
+#  - http://docs.openstack.org/infra/bindep/
6
+#  - https://github.com/openstack-infra/bindep
7
+#
8
+# Even if the role does not make use of this facility, it
9
+# is better to have this file empty, otherwise OpenStack-CI
10
+# will fall back to installing its default packages which
11
+# will potentially be detrimental to the tests executed.
12
+
13
+# Base requirements for Ubuntu
14
+build-essential   [platform:dpkg]
15
+git-core          [platform:dpkg]
16
+libssl-dev        [platform:dpkg]
17
+libffi-dev        [platform:dpkg]
18
+python2.7         [platform:dpkg]
19
+python-dev        [platform:dpkg]
20
+
21
+# Base requirements for CentOS
22
+gcc               [platform:rpm]
23
+gcc-c++           [platform:rpm]
24
+git               [platform:rpm]
25
+python-devel      [platform:rpm]
26
+libffi-devel      [platform:rpm]
27
+openssl-devel     [platform:rpm]
28
+
29
+# For SELinux
30
+libselinux-python [platform:rpm]
31
+
32
+# For SSL SNI support
33
+python-pyasn1               [platform:dpkg]
34
+python-openssl              [platform:dpkg]
35
+python-ndg-httpsclient      [platform:ubuntu !platform:ubuntu-trusty]
36
+python2-pyasn1              [platform:rpm]
37
+python2-pyOpenSSL           [platform:rpm]
38
+python-ndg_httpsclient      [platform:rpm]
39
+
40
+# Required for compressing collected log files in CI
41
+gzip

+ 103
- 0
defaults/main.yml View File

@@ -0,0 +1,103 @@
1
+---
2
+# Copyright 2017, Rackspace US, Inc.
3
+#
4
+# Licensed under the Apache License, Version 2.0 (the "License");
5
+# you may not use this file except in compliance with the License.
6
+# You may obtain a copy of the License at
7
+#
8
+#     http://www.apache.org/licenses/LICENSE-2.0
9
+#
10
+# Unless required by applicable law or agreed to in writing, software
11
+# distributed under the License is distributed on an "AS IS" BASIS,
12
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+# See the License for the specific language governing permissions and
14
+# limitations under the License.
15
+
16
+# Cleanup all known network interfaces
17
+systemd_interface_cleanup: false
18
+
19
+# Enable systemd-networkd and (re)start the service
20
+systemd_run_networkd: false
21
+
22
+# The `systemd_link_config_overrides` option can be used on the default link.
23
+#  See the following link for all available options:
24
+#   https://www.freedesktop.org/software/systemd/man/systemd.link.html
25
+# systemd_default_unit:
26
+#   Match:
27
+#     Driver=things other thing
28
+systemd_link_config_overrides: {}
29
+
30
+# All items listed in the `systemd_netdevs` array are craeted using the exact
31
+# networkd syntax found here:
32
+#   https://www.freedesktop.org/software/systemd/man/systemd.netdev.html
33
+# At an absolute minimum, the items must have "NetDev" and "Name" defined.
34
+# Items generated will have an integer assigned to them so that they're loaded
35
+# in the order specified.
36
+
37
+# systemd_netdevs:
38
+#   - NetDev:
39
+#       Name: dummy0
40
+#       Kind: dummy
41
+#   - NetDev:
42
+#       Name: dummy1
43
+#       Kind: dummy
44
+#   - NetDev:
45
+#       Name: bond0
46
+#       Kind: bond
47
+#     Bond:
48
+#       Mode: 802.3ad
49
+#       TransmitHashPolicy: layer3+4
50
+#       MIIMonitorSec: 1s
51
+#       LACPTransmitRate: fast
52
+#   - NetDev:
53
+#       Name: br-dummy
54
+#       Kind: bridge
55
+
56
+systemd_netdevs: []
57
+
58
+# The systemd networkd dictionary is a set of networks that will be created.
59
+# items generated will have an integer assigned to them so that they're loaded
60
+# in the order specified. The dictionary can contain the following options:
61
+#  `config_overrides` -- (optional) used to inject extra configuration options
62
+#                                   into the network file. A full list of all
63
+#                                   options can be found here:
64
+#                                   https://www.freedesktop.org/software/systemd/man/systemd.network.html
65
+#  `interface` -- (required) Name of interface to match
66
+#  `address` -- (option) IP address the interface should be given. To make this
67
+#                        interface use DHCP set this string to "dhcp"
68
+#  `netmask` -- (optional) Netmask to use for the interface
69
+#  `gateway` -- (optional) Gateway to use for the interface
70
+#  `bridge` -- (optional) Bridge name for a mapped interface
71
+#  `bond` -- (optional) Bond name for a mapped interface
72
+#  `vlan` -- (optional) VLAN name for a mapped interface
73
+#  `macvlan` -- (optional) MACVLAN name for a mapped interface
74
+#  `vxlan` -- (optional) VXLAN name for a mapped interface
75
+#  `mtu` -- (optional) MTU to use for the interface
76
+#  `usedns` -- (optional) When set to true the interface will accept DNS when
77
+#                         running in dhcp mode
78
+#  `static_routes` -- (optional) list of routes to use for the network. This
79
+#                                option requires a gateway and cidr to be set
80
+#                                within the list item.
81
+
82
+# systemd_networks:
83
+#   - interface: "dummy0"
84
+#     bridge: "bond0"
85
+#     mtu: 9000
86
+#   - interface: "dummy1"
87
+#     bridge: "bond0"
88
+#     mtu: 9000
89
+#   - interface: "bond0"
90
+#     bridge: "br-dummy"
91
+#     mtu: 9000
92
+#   - interface: "br-dummy"
93
+#     bridge: "br-dummy"
94
+#     address: "10.0.0.100"
95
+#     netmask: "255.255.255.0"
96
+#     gateway: "10.0.0.1"
97
+#     mtu: 9000
98
+#     usedns: true
99
+#     config_overrides:
100
+#       Network:
101
+#         ConfigureWithoutCarrier: true
102
+
103
+systemd_networks: []

+ 195
- 0
doc/Makefile View File

@@ -0,0 +1,195 @@
1
+# Makefile for Sphinx documentation
2
+#
3
+
4
+# You can set these variables from the command line.
5
+SPHINXOPTS    =
6
+SPHINXBUILD   = sphinx-build
7
+PAPER         =
8
+BUILDDIR      = build
9
+
10
+# User-friendly check for sphinx-build
11
+ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
12
+$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
13
+endif
14
+
15
+# Internal variables.
16
+PAPEROPT_a4     = -D latex_paper_size=a4
17
+PAPEROPT_letter = -D latex_paper_size=letter
18
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
19
+# the i18n builder cannot share the environment and doctrees with the others
20
+I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
21
+
22
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext
23
+
24
+help:
25
+	@echo "Please use \`make <target>' where <target> is one of"
26
+	@echo "  html       to make standalone HTML files"
27
+	@echo "  dirhtml    to make HTML files named index.html in directories"
28
+	@echo "  singlehtml to make a single large HTML file"
29
+	@echo "  pickle     to make pickle files"
30
+	@echo "  json       to make JSON files"
31
+	@echo "  htmlhelp   to make HTML files and a HTML help project"
32
+	@echo "  qthelp     to make HTML files and a qthelp project"
33
+	@echo "  applehelp  to make an Apple Help Book"
34
+	@echo "  devhelp    to make HTML files and a Devhelp project"
35
+	@echo "  epub       to make an epub"
36
+	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
37
+	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
38
+	@echo "  latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
39
+	@echo "  text       to make text files"
40
+	@echo "  man        to make manual pages"
41
+	@echo "  texinfo    to make Texinfo files"
42
+	@echo "  info       to make Texinfo files and run them through makeinfo"
43
+	@echo "  gettext    to make PO message catalogs"
44
+	@echo "  changes    to make an overview of all changed/added/deprecated items"
45
+	@echo "  xml        to make Docutils-native XML files"
46
+	@echo "  pseudoxml  to make pseudoxml-XML files for display purposes"
47
+	@echo "  linkcheck  to check all external links for integrity"
48
+	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
49
+	@echo "  coverage   to run coverage check of the documentation (if enabled)"
50
+
51
+clean:
52
+	rm -rf $(BUILDDIR)/*
53
+
54
+html:
55
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
56
+	@echo
57
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
58
+
59
+dirhtml:
60
+	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
61
+	@echo
62
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
63
+
64
+singlehtml:
65
+	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
66
+	@echo
67
+	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
68
+
69
+pickle:
70
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
71
+	@echo
72
+	@echo "Build finished; now you can process the pickle files."
73
+
74
+json:
75
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
76
+	@echo
77
+	@echo "Build finished; now you can process the JSON files."
78
+
79
+htmlhelp:
80
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
81
+	@echo
82
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
83
+	      ".hhp project file in $(BUILDDIR)/htmlhelp."
84
+
85
+qthelp:
86
+	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
87
+	@echo
88
+	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
89
+	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
90
+	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/ansible-systemd_networkd.qhcp"
91
+	@echo "To view the help file:"
92
+	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/ansible-systemd_networkd.qhc"
93
+
94
+applehelp:
95
+	$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
96
+	@echo
97
+	@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
98
+	@echo "N.B. You won't be able to view it unless you put it in" \
99
+	      "~/Library/Documentation/Help or install it in your application" \
100
+	      "bundle."
101
+
102
+devhelp:
103
+	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
104
+	@echo
105
+	@echo "Build finished."
106
+	@echo "To view the help file:"
107
+	@echo "# mkdir -p $$HOME/.local/share/devhelp/ansible-systemd_networkd"
108
+	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/ansible-systemd_networkd"
109
+	@echo "# devhelp"
110
+
111
+epub:
112
+	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
113
+	@echo
114
+	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
115
+
116
+latex:
117
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
118
+	@echo
119
+	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
120
+	@echo "Run \`make' in that directory to run these through (pdf)latex" \
121
+	      "(use \`make latexpdf' here to do that automatically)."
122
+
123
+latexpdf:
124
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
125
+	@echo "Running LaTeX files through pdflatex..."
126
+	$(MAKE) -C $(BUILDDIR)/latex all-pdf
127
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
128
+
129
+latexpdfja:
130
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
131
+	@echo "Running LaTeX files through platex and dvipdfmx..."
132
+	$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
133
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
134
+
135
+text:
136
+	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
137
+	@echo
138
+	@echo "Build finished. The text files are in $(BUILDDIR)/text."
139
+
140
+man:
141
+	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
142
+	@echo
143
+	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
144
+
145
+texinfo:
146
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
147
+	@echo
148
+	@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
149
+	@echo "Run \`make' in that directory to run these through makeinfo" \
150
+	      "(use \`make info' here to do that automatically)."
151
+
152
+info:
153
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
154
+	@echo "Running Texinfo files through makeinfo..."
155
+	make -C $(BUILDDIR)/texinfo info
156
+	@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
157
+
158
+gettext:
159
+	$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
160
+	@echo
161
+	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
162
+
163
+changes:
164
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
165
+	@echo
166
+	@echo "The overview file is in $(BUILDDIR)/changes."
167
+
168
+linkcheck:
169
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
170
+	@echo
171
+	@echo "Link check complete; look for any errors in the above output " \
172
+	      "or in $(BUILDDIR)/linkcheck/output.txt."
173
+
174
+doctest:
175
+	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
176
+	@echo "Testing of doctests in the sources finished, look at the " \
177
+	      "results in $(BUILDDIR)/doctest/output.txt."
178
+
179
+coverage:
180
+	$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
181
+	@echo "Testing of coverage in the sources finished, look at the " \
182
+	      "results in $(BUILDDIR)/coverage/python.txt."
183
+
184
+xml:
185
+	$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
186
+	@echo
187
+	@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
188
+
189
+pseudoxml:
190
+	$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
191
+	@echo
192
+	@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
193
+
194
+livehtml: html
195
+	sphinx-autobuild -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html

+ 338
- 0
doc/source/conf.py View File

@@ -0,0 +1,338 @@
1
+#!/usr/bin/env python3
2
+
3
+# Licensed under the Apache License, Version 2.0 (the "License");
4
+# you may not use this file except in compliance with the License.
5
+# You may obtain a copy of the License at
6
+#
7
+#    http://www.apache.org/licenses/LICENSE-2.0
8
+#
9
+# Unless required by applicable law or agreed to in writing, software
10
+# distributed under the License is distributed on an "AS IS" BASIS,
11
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12
+# implied.
13
+# See the License for the specific language governing permissions and
14
+# limitations under the License.
15
+
16
+# This file is execfile()d with the current directory set to its
17
+# containing dir.
18
+#
19
+# Note that not all possible configuration values are present in this
20
+# autogenerated file.
21
+#
22
+# All configuration values have a default; values that are commented out
23
+# serve to show the default.
24
+
25
+import openstackdocstheme
26
+import pbr.version
27
+import os
28
+
29
+# If extensions (or modules to document with autodoc) are in another directory,
30
+# add these directories to sys.path here. If the directory is relative to the
31
+# documentation root, use os.path.abspath to make it absolute, like shown here.
32
+# sys.path.insert(0, os.path.abspath('.'))
33
+
34
+# -- General configuration ------------------------------------------------
35
+
36
+# If your documentation needs a minimal Sphinx version, state it here.
37
+# needs_sphinx = '1.0'
38
+
39
+# Add any Sphinx extension module names here, as strings. They can be
40
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
41
+# ones.
42
+extensions = [
43
+    'sphinx.ext.autodoc',
44
+    'oslosphinx',
45
+    'sphinxmark'
46
+]
47
+
48
+# Add any paths that contain templates here, relative to this directory.
49
+templates_path = ['_templates']
50
+
51
+# The suffix(es) of source filenames.
52
+# You can specify multiple suffix as a list of string:
53
+# source_suffix = ['.rst', '.md']
54
+source_suffix = '.rst'
55
+
56
+# The encoding of source files.
57
+# source_encoding = 'utf-8-sig'
58
+
59
+# The master toctree document.
60
+master_doc = 'index'
61
+
62
+# General information about the project.
63
+author = 'OpenStack-Ansible Contributors'
64
+category = 'Miscellaneous'
65
+copyright = '2014-2018, OpenStack-Ansible Contributors'
66
+description = 'OpenStack-Ansible deploys OpenStack environments using Ansible.'
67
+project = 'OpenStack-Ansible'
68
+role_name = 'os_nova'
69
+target_name = 'openstack-ansible-' + role_name
70
+title = 'OpenStack-Ansible Documentation: ' + role_name + 'role'
71
+
72
+# The link to the browsable source code (for the left hand menu)
73
+oslosphinx_cgit_link = 'https://git.openstack.org/cgit/openstack/' + target_name
74
+
75
+# The version info for the project you're documenting, acts as replacement for
76
+# |version| and |release|, also used in various other places throughout the
77
+# built documents.
78
+#
79
+# The short X.Y version.
80
+version_info = pbr.version.VersionInfo(target_name)
81
+# The full version, including alpha/beta/rc tags.
82
+release = version_info.version_string_with_vcs()
83
+# The short X.Y version.
84
+version = version_info.canonical_version_string()
85
+
86
+# A few variables have to be set for the log-a-bug feature.
87
+#   giturl: The location of conf.py on Git. Must be set manually.
88
+#   gitsha: The SHA checksum of the bug description.
89
+#           Automatically extracted from git log.
90
+#   bug_tag: Tag for categorizing the bug. Must be set manually.
91
+# These variables are passed to the logabug code via html_context.
92
+giturl = ("https://git.openstack.org/cgit/openstack/{0}"
93
+          "/tree/doc/source").format(target_name)
94
+git_cmd = "/usr/bin/git log | head -n1 | cut -f2 -d' '"
95
+gitsha = os.popen(git_cmd).read().strip('\n')
96
+bug_project = project.lower()
97
+bug_title = "Documentation bug"
98
+html_context = {"gitsha": gitsha, "giturl": giturl,
99
+                "bug_tag": "docs", "bug_title": bug_title,
100
+                "bug_project": bug_project}
101
+
102
+# The language for content autogenerated by Sphinx. Refer to documentation
103
+# for a list of supported languages.
104
+#
105
+# This is also used if you do content translation via gettext catalogs.
106
+# Usually you set "language" from the command line for these cases.
107
+language = None
108
+
109
+# There are two options for replacing |today|: either, you set today to some
110
+# non-false value, then it is used:
111
+# today = ''
112
+# Else, today_fmt is used as the format for a strftime call.
113
+# today_fmt = '%B %d, %Y'
114
+
115
+# List of patterns, relative to source directory, that match files and
116
+# directories to ignore when looking for source files.
117
+exclude_patterns = []
118
+
119
+# The reST default role (used for this markup: `text`) to use for all
120
+# documents.
121
+# default_role = None
122
+
123
+# If true, '()' will be appended to :func: etc. cross-reference text.
124
+# add_function_parentheses = True
125
+
126
+# If true, the current module name will be prepended to all description
127
+# unit titles (such as .. function::).
128
+# add_module_names = True
129
+
130
+# If true, sectionauthor and moduleauthor directives will be shown in the
131
+# output. They are ignored by default.
132
+# show_authors = False
133
+
134
+# The name of the Pygments (syntax highlighting) style to use.
135
+pygments_style = 'sphinx'
136
+
137
+# A list of ignored prefixes for module index sorting.
138
+# modindex_common_prefix = []
139
+
140
+# If true, keep warnings as "system message" paragraphs in the built documents.
141
+# keep_warnings = False
142
+
143
+# If true, `todo` and `todoList` produce output, else they produce nothing.
144
+todo_include_todos = False
145
+
146
+
147
+# -- Options for HTML output ----------------------------------------------
148
+
149
+# The theme to use for HTML and HTML Help pages.  See the documentation for
150
+# a list of builtin themes.
151
+html_theme = 'openstackdocs'
152
+
153
+# Theme options are theme-specific and customize the look and feel of a theme
154
+# further.  For a list of options available for each theme, see the
155
+# documentation.
156
+# html_theme_options = {}
157
+
158
+# Add any paths that contain custom themes here, relative to this directory.
159
+html_theme_path = [openstackdocstheme.get_html_theme_path()]
160
+
161
+# The name for this set of Sphinx documents.  If None, it defaults to
162
+# "<project> v<release> documentation".
163
+# html_title = None
164
+
165
+# A shorter title for the navigation bar.  Default is the same as html_title.
166
+# html_short_title = None
167
+
168
+# The name of an image file (relative to this directory) to place at the top
169
+# of the sidebar.
170
+# html_logo = None
171
+
172
+# The name of an image file (within the static path) to use as favicon of the
173
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
174
+# pixels large.
175
+# html_favicon = None
176
+
177
+# Add any paths that contain custom static files (such as style sheets) here,
178
+# relative to this directory. They are copied after the builtin static files,
179
+# so a file named "default.css" will overwrite the builtin "default.css".
180
+html_static_path = ['_static']
181
+
182
+# Add any extra paths that contain custom files (such as robots.txt or
183
+# .htaccess) here, relative to this directory. These files are copied
184
+# directly to the root of the documentation.
185
+# html_extra_path = []
186
+
187
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
188
+# using the given strftime format.
189
+html_last_updated_fmt = '%Y-%m-%d %H:%M'
190
+
191
+# If true, SmartyPants will be used to convert quotes and dashes to
192
+# typographically correct entities.
193
+# html_use_smartypants = True
194
+
195
+# Custom sidebar templates, maps document names to template names.
196
+# html_sidebars = {}
197
+
198
+# Additional templates that should be rendered to pages, maps page names to
199
+# template names.
200
+# html_additional_pages = {}
201
+
202
+# If false, no module index is generated.
203
+# html_domain_indices = True
204
+
205
+# If false, no index is generated.
206
+# html_use_index = True
207
+
208
+# If true, the index is split into individual pages for each letter.
209
+# html_split_index = False
210
+
211
+# If true, links to the reST sources are added to the pages.
212
+# html_show_sourcelink = True
213
+
214
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
215
+# html_show_sphinx = True
216
+
217
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
218
+# html_show_copyright = True
219
+
220
+# If true, an OpenSearch description file will be output, and all pages will
221
+# contain a <link> tag referring to it.  The value of this option must be the
222
+# base URL from which the finished HTML is served.
223
+# html_use_opensearch = ''
224
+
225
+# This is the file name suffix for HTML files (e.g. ".xhtml").
226
+# html_file_suffix = None
227
+
228
+# Language to be used for generating the HTML full-text search index.
229
+# Sphinx supports the following languages:
230
+#   'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
231
+#   'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
232
+# html_search_language = 'en'
233
+
234
+# A dictionary with options for the search language support, empty by default.
235
+# Now only 'ja' uses this config value
236
+# html_search_options = {'type': 'default'}
237
+
238
+# The name of a javascript file (relative to the configuration directory) that
239
+# implements a search results scorer. If empty, the default will be used.
240
+# html_search_scorer = 'scorer.js'
241
+
242
+# Output file base name for HTML help builder.
243
+htmlhelp_basename = target_name + '-docs'
244
+
245
+# -- Options for LaTeX output ---------------------------------------------
246
+
247
+latex_elements = {
248
+    # The paper size ('letterpaper' or 'a4paper').
249
+    # 'papersize': 'letterpaper',
250
+
251
+    # The font size ('10pt', '11pt' or '12pt').
252
+    # 'pointsize': '10pt',
253
+
254
+    # Additional stuff for the LaTeX preamble.
255
+    # 'preamble': '',
256
+
257
+    # Latex figure (float) alignment
258
+    # 'figure_align': 'htbp',
259
+}
260
+
261
+# Grouping the document tree into LaTeX files. List of tuples
262
+# (source start file, target name, title,
263
+#  author, documentclass [howto, manual, or own class]).
264
+latex_documents = [
265
+    (master_doc, target_name + '.tex',
266
+     title, author, 'manual'),
267
+]
268
+
269
+# The name of an image file (relative to this directory) to place at the top of
270
+# the title page.
271
+# latex_logo = None
272
+
273
+# For "manual" documents, if this is true, then toplevel headings are parts,
274
+# not chapters.
275
+# latex_use_parts = False
276
+
277
+# If true, show page references after internal links.
278
+# latex_show_pagerefs = False
279
+
280
+# If true, show URL addresses after external links.
281
+# latex_show_urls = False
282
+
283
+# Documents to append as an appendix to all manuals.
284
+# latex_appendices = []
285
+
286
+# If false, no module index is generated.
287
+# latex_domain_indices = True
288
+
289
+
290
+# -- Options for manual page output ---------------------------------------
291
+
292
+# One entry per manual page. List of tuples
293
+# (source start file, name, description, authors, manual section).
294
+man_pages = [
295
+    (master_doc, target_name,
296
+     title, [author], 1)
297
+]
298
+
299
+# If true, show URL addresses after external links.
300
+# man_show_urls = False
301
+
302
+
303
+# -- Options for Texinfo output -------------------------------------------
304
+
305
+# Grouping the document tree into Texinfo files. List of tuples
306
+# (source start file, target name, title, author,
307
+#  dir menu entry, description, category)
308
+texinfo_documents = [
309
+    (master_doc, target_name,
310
+     title, author, project,
311
+     description, category),
312
+]
313
+
314
+# Documents to append as an appendix to all manuals.
315
+# texinfo_appendices = []
316
+
317
+# If false, no module index is generated.
318
+# texinfo_domain_indices = True
319
+
320
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
321
+# texinfo_show_urls = 'footnote'
322
+
323
+# If true, do not generate a @detailmenu in the "Top" node's menu.
324
+# texinfo_no_detailmenu = False
325
+
326
+
327
+watermark = os.popen("git branch --contains $(git rev-parse HEAD)\
328
+| awk -F/ '/stable/ {print $2}'").read().strip(' \n\t').capitalize()
329
+if watermark == "":
330
+    watermark = "Pre-release"
331
+
332
+# -- Options for sphinxmark -----------------------------------------------
333
+sphinxmark_enable = True
334
+sphinxmark_div = 'docs-body'
335
+sphinxmark_image = 'text'
336
+sphinxmark_text = watermark
337
+sphinxmark_text_color = (128, 128, 128)
338
+sphinxmark_text_size = 70

+ 26
- 0
doc/source/index.rst View File

@@ -0,0 +1,26 @@
1
+===========================================
2
+systemd_networkd role for OpenStack-Ansible
3
+===========================================
4
+
5
+:tags: openstack, systemd_networkd, cloud, ansible
6
+:category: \*nix
7
+
8
+This role will configure Systemd units:
9
+
10
+Default variables
11
+~~~~~~~~~~~~~~~~~
12
+
13
+.. literalinclude:: ../../defaults/main.yml
14
+   :language: yaml
15
+   :start-after: under the License.
16
+
17
+Example playbook
18
+~~~~~~~~~~~~~~~~
19
+
20
+.. literalinclude:: ../../examples/playbook.yml
21
+   :language: yaml
22
+
23
+Tags
24
+~~~~
25
+
26
+This role supports one tag: ``systemd-init``.

+ 44
- 0
examples/playbook.yml View File

@@ -0,0 +1,44 @@
1
+.. code-block:: yaml
2
+
3
+    - name: Create a systemd-networkd interfaces
4
+      hosts: localhost
5
+      become: true
6
+      roles:
7
+        - role: "systemd_networkd"
8
+          systemd_netdevs:
9
+            - NetDev:
10
+                Name: dummy0
11
+                Kind: dummy
12
+            - NetDev:
13
+                Name: dummy1
14
+                Kind: dummy
15
+            - NetDev:
16
+                Name: bond0
17
+                Kind: bond
18
+              Bond:
19
+                Mode: 802.3ad
20
+                TransmitHashPolicy: layer3+4
21
+                MIIMonitorSec: 1s
22
+                LACPTransmitRate: fast
23
+            - NetDev:
24
+                Name: br-dummy
25
+                Kind: bridge
26
+          systemd_networks:
27
+            - interface: "dummy0"
28
+              bond: "bond0"
29
+              mtu: 9000
30
+            - interface: "dummy1"
31
+              bond: "bond0"
32
+              mtu: 9000
33
+            - interface: "bond0"
34
+              bridge: "br-dummy"
35
+              mtu: 9000
36
+            - interface: "br-dummy"
37
+              address: "10.0.0.100"
38
+              netmask: "255.255.255.0"
39
+              gateway: "10.0.0.1"
40
+              mtu: 9000
41
+              usedns: true
42
+              config_overrides:
43
+                Network:
44
+                  ConfigureWithoutCarrier: true

+ 38
- 0
handlers/main.yml View File

@@ -0,0 +1,38 @@
1
+---
2
+# Copyright 2018, Rackspace US, Inc.
3
+#
4
+# Licensed under the Apache License, Version 2.0 (the "License");
5
+# you may not use this file except in compliance with the License.
6
+# You may obtain a copy of the License at
7
+#
8
+#     http://www.apache.org/licenses/LICENSE-2.0
9
+#
10
+# Unless required by applicable law or agreed to in writing, software
11
+# distributed under the License is distributed on an "AS IS" BASIS,
12
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+# See the License for the specific language governing permissions and
14
+# limitations under the License.
15
+
16
+- name: Delete mount file(s)
17
+  file:
18
+    path: "/etc/systemd/system/{{ item.where.strip('/') | replace('/', '-') }}.{{ item.type == 'swap' | ternary('swap', 'mount') }}"
19
+    state: "absent"
20
+  when:
21
+    - item.state | default('unknown') == 'absent'
22
+  with_items: "{{ systemd_networkds }}"
23
+  listen: Remove mount
24
+
25
+- name: Delete mount target(s)
26
+  file:
27
+    path: "{{ item.where }}"
28
+    state: "absent"
29
+  when:
30
+    - item.state | default('unknown') == 'absent'
31
+  with_items: "{{ systemd_networkds }}"
32
+  listen: Remove mount
33
+
34
+- name: Reload systemd daemon
35
+  systemd:
36
+    daemon_reload: yes
37
+    no_block: yes
38
+  listen: Remove mount

+ 4
- 0
html-docs/.buildinfo View File

@@ -0,0 +1,4 @@
1
+# Sphinx build info version 1
2
+# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3
+config: 
4
+tags: 

+ 33
- 0
manual-test.rc View File

@@ -0,0 +1,33 @@
1
+export VIRTUAL_ENV=$(pwd)
2
+export ANSIBLE_HOST_KEY_CHECKING=False
3
+export ANSIBLE_SSH_CONTROL_PATH=/tmp/%%h-%%r
4
+
5
+# TODO (odyssey4me) These are only here as they are non-standard folder
6
+# names for Ansible 1.9.x. We are using the standard folder names for
7
+# Ansible v2.x. We can remove this when we move to Ansible 2.x.
8
+export ANSIBLE_ACTION_PLUGINS=${HOME}/.ansible/plugins/action
9
+export ANSIBLE_CALLBACK_PLUGINS=${HOME}/.ansible/plugins/callback
10
+export ANSIBLE_FILTER_PLUGINS=${HOME}/.ansible/plugins/filter
11
+export ANSIBLE_LOOKUP_PLUGINS=${HOME}/.ansible/plugins/lookup
12
+
13
+# This is required as the default is the current path or a path specified
14
+# in ansible.cfg
15
+export ANSIBLE_LIBRARY=${HOME}/.ansible/plugins/library
16
+
17
+# This is required as the default is '/etc/ansible/roles' or a path
18
+# specified in ansible.cfg
19
+export ANSIBLE_ROLES_PATH=${HOME}/.ansible/roles:$(pwd)/..
20
+
21
+export ANSIBLE_SSH_ARGS="-o ControlMaster=no \
22
+  -o UserKnownHostsFile=/dev/null \
23
+  -o StrictHostKeyChecking=no \
24
+  -o ServerAliveInterval=64 \
25
+  -o ServerAliveCountMax=1024 \
26
+  -o Compression=no \
27
+  -o TCPKeepAlive=yes \
28
+  -o VerifyHostKeyDNS=no \
29
+  -o ForwardX11=no \
30
+  -o ForwardAgent=yes"
31
+
32
+echo "Run manual functional tests by executing the following:"
33
+echo "# ./.tox/functional/bin/ansible-playbook -i tests/inventory tests/test.yml"

+ 38
- 0
meta/main.yml View File

@@ -0,0 +1,38 @@
1
+---
2
+# Copyright 2017, Rackspace US, Inc.
3
+#
4
+# Licensed under the Apache License, Version 2.0 (the "License");
5
+# you may not use this file except in compliance with the License.
6
+# You may obtain a copy of the License at
7
+#
8
+#     http://www.apache.org/licenses/LICENSE-2.0
9
+#
10
+# Unless required by applicable law or agreed to in writing, software
11
+# distributed under the License is distributed on an "AS IS" BASIS,
12
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+# See the License for the specific language governing permissions and
14
+# limitations under the License.
15
+
16
+galaxy_info:
17
+  author: rcbops
18
+  description: Installation and setup of systemd_networkd
19
+  company: Rackspace
20
+  license: Apache2
21
+  min_ansible_version: 2.0
22
+  platforms:
23
+    - name: Ubuntu
24
+      versions:
25
+        - xenial
26
+    - name: EL
27
+      versions:
28
+        - 7
29
+    - name: opensuse
30
+      versions:
31
+        - 42.1
32
+        - 42.2
33
+        - 42.3
34
+  categories:
35
+    - systemd
36
+    - development
37
+  dependencies:
38
+    - plugins

+ 0
- 0
releasenotes/notes/.placeholder View File


+ 0
- 0
releasenotes/source/_static/.placeholder View File


+ 0
- 0
releasenotes/source/_templates/.placeholder View File


+ 284
- 0
releasenotes/source/conf.py View File

@@ -0,0 +1,284 @@
1
+#!/usr/bin/env python3
2
+
3
+# Licensed under the Apache License, Version 2.0 (the "License");
4
+# you may not use this file except in compliance with the License.
5
+# You may obtain a copy of the License at
6
+#
7
+#    http://www.apache.org/licenses/LICENSE-2.0
8
+#
9
+# Unless required by applicable law or agreed to in writing, software
10
+# distributed under the License is distributed on an "AS IS" BASIS,
11
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12
+# implied.
13
+# See the License for the specific language governing permissions and
14
+# limitations under the License.
15
+
16
+# This file is execfile()d with the current directory set to its
17
+# containing dir.
18
+#
19
+# Note that not all possible configuration values are present in this
20
+# autogenerated file.
21
+#
22
+# All configuration values have a default; values that are commented out
23
+# serve to show the default.
24
+
25
+import pbr.version
26
+
27
+# If extensions (or modules to document with autodoc) are in another directory,
28
+# add these directories to sys.path here. If the directory is relative to the
29
+# documentation root, use os.path.abspath to make it absolute, like shown here.
30
+# sys.path.insert(0, os.path.abspath('.'))
31
+
32
+# -- General configuration ------------------------------------------------
33
+
34
+# If your documentation needs a minimal Sphinx version, state it here.
35
+# needs_sphinx = '1.0'
36
+
37
+# Add any Sphinx extension module names here, as strings. They can be
38
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
39
+# ones.
40
+extensions = [
41
+    'oslosphinx',
42
+    'reno.sphinxext',
43
+]
44
+
45
+# Add any paths that contain templates here, relative to this directory.
46
+templates_path = ['_templates']
47
+
48
+# The suffix of source filenames.
49
+source_suffix = '.rst'
50
+
51
+# The encoding of source files.
52
+# source_encoding = 'utf-8-sig'
53
+
54
+# The master toctree document.
55
+master_doc = 'index'
56
+
57
+# General information about the project.
58
+author = 'OpenStack-Ansible Contributors'
59
+category = 'Miscellaneous'
60
+copyright = '2014-2018, OpenStack-Ansible Contributors'
61
+description = 'OpenStack-Ansible deploys OpenStack environments using Ansible.'
62
+project = 'OpenStack-Ansible'
63
+role_name = 'systemd_networkd'
64
+target_name = 'openstack-ansible-' + role_name
65
+title = 'OpenStack-Ansible Release Notes: ' + role_name + 'role'
66
+
67
+# The link to the browsable source code (for the left hand menu)
68
+oslosphinx_cgit_link = 'https://git.openstack.org/cgit/openstack/' + target_name
69
+
70
+# The version info for the project you're documenting, acts as replacement for
71
+# |version| and |release|, also used in various other places throughout the
72
+# built documents.
73
+#
74
+# The short X.Y version.
75
+version_info = pbr.version.VersionInfo(target_name)
76
+# The full version, including alpha/beta/rc tags.
77
+release = version_info.version_string_with_vcs()
78
+# The short X.Y version.
79
+version = version_info.canonical_version_string()
80
+
81
+# The language for content autogenerated by Sphinx. Refer to documentation
82
+# for a list of supported languages.
83
+# language = None
84
+
85
+# There are two options for replacing |today|: either, you set today to some
86
+# non-false value, then it is used:
87
+# today = ''
88
+# Else, today_fmt is used as the format for a strftime call.
89
+# today_fmt = '%B %d, %Y'
90
+
91
+# List of patterns, relative to source directory, that match files and
92
+# directories to ignore when looking for source files.
93
+exclude_patterns = []
94
+
95
+# The reST default role (used for this markup: `text`) to use for all
96
+# documents.
97
+# default_role = None
98
+
99
+# If true, '()' will be appended to :func: etc. cross-reference text.
100
+# add_function_parentheses = True
101
+
102
+# If true, the current module name will be prepended to all description
103
+# unit titles (such as .. function::).
104
+# add_module_names = True
105
+
106
+# If true, sectionauthor and moduleauthor directives will be shown in the
107
+# output. They are ignored by default.
108
+# show_authors = False
109
+
110
+# The name of the Pygments (syntax highlighting) style to use.
111
+pygments_style = 'sphinx'
112
+
113
+# A list of ignored prefixes for module index sorting.
114
+# modindex_common_prefix = []
115
+
116
+# If true, keep warnings as "system message" paragraphs in the built documents.
117
+# keep_warnings = False
118
+
119
+
120
+# -- Options for HTML output ----------------------------------------------
121
+
122
+# The theme to use for HTML and HTML Help pages.  See the documentation for
123
+# a list of builtin themes.
124
+html_theme = 'default'
125
+
126
+# Theme options are theme-specific and customize the look and feel of a theme
127
+# further.  For a list of options available for each theme, see the
128
+# documentation.
129
+# html_theme_options = {}
130
+
131
+# Add any paths that contain custom themes here, relative to this directory.
132
+# html_theme_path = []
133
+
134
+# The name for this set of Sphinx documents.  If None, it defaults to
135
+# "<project> v<release> documentation".
136
+# html_title = None
137
+
138
+# A shorter title for the navigation bar.  Default is the same as html_title.
139
+# html_short_title = None
140
+
141
+# The name of an image file (relative to this directory) to place at the top
142
+# of the sidebar.
143
+# html_logo = None
144
+
145
+# The name of an image file (within the static path) to use as favicon of the
146
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
147
+# pixels large.
148
+# html_favicon = None
149
+
150
+# Add any paths that contain custom static files (such as style sheets) here,
151
+# relative to this directory. They are copied after the builtin static files,
152
+# so a file named "default.css" will overwrite the builtin "default.css".
153
+html_static_path = ['_static']
154
+
155
+# Add any extra paths that contain custom files (such as robots.txt or
156
+# .htaccess) here, relative to this directory. These files are copied
157
+# directly to the root of the documentation.
158
+# html_extra_path = []
159
+
160
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
161
+# using the given strftime format.
162
+html_last_updated_fmt = '%Y-%m-%d %H:%M'
163
+
164
+# If true, SmartyPants will be used to convert quotes and dashes to
165
+# typographically correct entities.
166
+# html_use_smartypants = True
167
+
168
+# Custom sidebar templates, maps document names to template names.
169
+# html_sidebars = {}
170
+
171
+# Additional templates that should be rendered to pages, maps page names to
172
+# template names.
173
+# html_additional_pages = {}
174
+
175
+# If false, no module index is generated.
176
+# html_domain_indices = True
177
+
178
+# If false, no index is generated.
179
+# html_use_index = True
180
+
181
+# If true, the index is split into individual pages for each letter.
182
+# html_split_index = False
183
+
184
+# If true, links to the reST sources are added to the pages.
185
+# html_show_sourcelink = True
186
+
187
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
188
+# html_show_sphinx = True
189
+
190
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
191
+# html_show_copyright = True
192
+
193
+# If true, an OpenSearch description file will be output, and all pages will
194
+# contain a <link> tag referring to it.  The value of this option must be the
195
+# base URL from which the finished HTML is served.
196
+# html_use_opensearch = ''
197
+
198
+# This is the file name suffix for HTML files (e.g. ".xhtml").
199
+# html_file_suffix = None
200
+
201
+# Output file base name for HTML help builder.
202
+htmlhelp_basename = target_name + '-docs'
203
+
204
+
205
+# -- Options for LaTeX output ---------------------------------------------
206
+
207
+latex_elements = {
208
+    # The paper size ('letterpaper' or 'a4paper').
209
+    # 'papersize': 'letterpaper',
210
+
211
+    # The font size ('10pt', '11pt' or '12pt').
212
+    # 'pointsize': '10pt',
213
+
214
+    # Additional stuff for the LaTeX preamble.
215
+    # 'preamble': '',
216
+}
217
+
218
+# Grouping the document tree into LaTeX files. List of tuples
219
+# (source start file, target name, title,
220
+#  author, documentclass [howto, manual, or own class]).
221
+latex_documents = [
222
+    (master_doc, target_name + '.tex',
223
+     title, author, 'manual'),
224
+]
225
+
226
+# The name of an image file (relative to this directory) to place at the top of
227
+# the title page.
228
+# latex_logo = None
229
+
230
+# For "manual" documents, if this is true, then toplevel headings are parts,
231
+# not chapters.
232
+# latex_use_parts = False
233
+
234
+# If true, show page references after internal links.
235
+# latex_show_pagerefs = False
236
+
237
+# If true, show URL addresses after external links.
238
+# latex_show_urls = False
239
+
240
+# Documents to append as an appendix to all manuals.
241
+# latex_appendices = []
242
+
243
+# If false, no module index is generated.
244
+# latex_domain_indices = True
245
+
246
+
247
+# -- Options for manual page output ---------------------------------------
248
+
249
+# One entry per manual page. List of tuples
250
+# (source start file, name, description, authors, manual section).
251
+man_pages = [
252
+    (master_doc, target_name,
253
+     title, [author], 1)
254
+]
255
+
256
+# If true, show URL addresses after external links.
257
+# man_show_urls = False
258
+
259
+
260
+# -- Options for Texinfo output -------------------------------------------
261
+
262
+# Grouping the document tree into Texinfo files. List of tuples
263
+# (source start file, target name, title, author,
264
+#  dir menu entry, description, category)
265
+texinfo_documents = [
266
+    (master_doc, target_name,
267
+     title, author, project,
268
+     description, category),
269
+]
270
+
271
+# Documents to append as an appendix to all manuals.
272
+# texinfo_appendices = []
273
+
274
+# If false, no module index is generated.
275
+# texinfo_domain_indices = True
276
+
277
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
278
+# texinfo_show_urls = 'footnote'
279
+
280
+# If true, do not generate a @detailmenu in the "Top" node's menu.
281
+# texinfo_no_detailmenu = False
282
+
283
+# -- Options for Internationalization output ------------------------------
284
+locale_dirs = ['locale/']

+ 8
- 0
releasenotes/source/index.rst View File

@@ -0,0 +1,8 @@
1
+===============================
2
+OpenStack-Ansible Release Notes
3
+===============================
4
+
5
+.. toctree::
6
+   :maxdepth: 1
7
+
8
+   unreleased

+ 5
- 0
releasenotes/source/unreleased.rst View File

@@ -0,0 +1,5 @@
1
+==============================
2
+ Current Series Release Notes
3
+==============================
4
+
5
+.. release-notes::

+ 74
- 0
run_tests.sh View File

@@ -0,0 +1,74 @@
1
+#!/usr/bin/env bash
2
+# Copyright 2018, Rackspace US, Inc.
3
+#
4
+# Licensed under the Apache License, Version 2.0 (the "License");
5
+# you may not use this file except in compliance with the License.
6
+# You may obtain a copy of the License at
7
+#
8
+#     http://www.apache.org/licenses/LICENSE-2.0
9
+#
10
+# Unless required by applicable law or agreed to in writing, software
11
+# distributed under the License is distributed on an "AS IS" BASIS,
12
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+# See the License for the specific language governing permissions and
14
+# limitations under the License.
15
+
16
+set -xeuo pipefail
17
+
18
+FUNCTIONAL_TEST=${FUNCTIONAL_TEST:-true}
19
+
20
+# Install python2 for Ubuntu 16.04 and CentOS 7
21
+if which apt-get; then
22
+    sudo apt-get update && sudo apt-get install -y python
23
+fi
24
+
25
+if which yum; then
26
+    sudo yum install -y python
27
+fi
28
+
29
+# Install pip.
30
+if ! which pip; then
31
+  curl --silent --show-error --retry 5 \
32
+    https://bootstrap.pypa.io/get-pip.py | sudo python2.7
33
+fi
34
+
35
+# Install bindep and tox with pip.
36
+sudo pip install bindep tox
37
+
38
+# CentOS 7 requires two additional packages:
39
+#   redhat-lsb-core - for bindep profile support
40
+#   epel-release    - required to install python-ndg_httpsclient/python2-pyasn1
41
+if which yum; then
42
+    sudo yum -y install redhat-lsb-core epel-release
43
+fi
44
+
45
+# Get a list of packages to install with bindep. If packages need to be
46
+# installed, bindep exits with an exit code of 1.
47
+BINDEP_PKGS=$(bindep -b -f bindep.txt test || true)
48
+echo "Packages to install: ${BINDEP_PKGS}"
49
+
50
+# Install a list of OS packages provided by bindep.
51
+if which apt-get; then
52
+    sudo apt-get update
53
+    DEBIAN_FRONTEND=noninteractive \
54
+      sudo apt-get -q --option "Dpkg::Options::=--force-confold" \
55
+      --assume-yes install $BINDEP_PKGS
56
+elif which yum; then
57
+    # Don't run yum with an empty list of packages.
58
+    # It will fail and cause the script to exit with an error.
59
+    if [[ ${#BINDEP_PKGS} > 0 ]]; then
60
+      sudo yum install -y $BINDEP_PKGS
61
+    fi
62
+fi
63
+
64
+# Loop through each tox environment and run tests.
65
+for tox_env in $(awk -F= '/envlist/ { gsub(",", " "); print $2 }' tox.ini); do
66
+  echo "Executing tox environment: ${tox_env}"
67
+  if [[ ${tox_env} == ansible-functional ]]; then
68
+    if ${FUNCTIONAL_TEST}; then
69
+      tox -e ${tox_env}
70
+    fi
71
+  else
72
+    tox -e ${tox_env}
73
+  fi
74
+done

+ 24
- 0
setup.cfg View File

@@ -0,0 +1,24 @@
1
+[metadata]
2
+name = systemd_networkd
3
+summary = systemd_networkd for OpenStack Ansible
4
+description-file =
5
+    README.rst
6
+author = OpenStack
7
+author-email = openstack-dev@lists.openstack.org
8
+home-page = http://docs.openstack.org/developer/ansible-systemd_networkd/
9
+classifier =
10
+    Intended Audience :: Developers
11
+    Intended Audience :: System Administrators
12
+    License :: OSI Approved :: Apache Software License
13
+    Operating System :: POSIX :: Linux
14
+
15
+[build_sphinx]
16
+all_files = 1
17
+build-dir = doc/build
18
+source-dir = doc/source
19
+
20
+[pbr]
21
+warnerrors = True
22
+
23
+[wheel]
24
+universal = 1

+ 29
- 0
setup.py View File

@@ -0,0 +1,29 @@
1
+# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
2
+#
3
+# Licensed under the Apache License, Version 2.0 (the "License");
4
+# you may not use this file except in compliance with the License.
5
+# You may obtain a copy of the License at
6
+#
7
+#    http://www.apache.org/licenses/LICENSE-2.0
8
+#
9
+# Unless required by applicable law or agreed to in writing, software
10
+# distributed under the License is distributed on an "AS IS" BASIS,
11
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12
+# implied.
13
+# See the License for the specific language governing permissions and
14
+# limitations under the License.
15
+
16
+# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
17
+import setuptools
18
+
19
+# In python < 2.7.4, a lazy loading of package `pbr` will break
20
+# setuptools if some other modules registered functions in `atexit`.
21
+# solution from: http://bugs.python.org/issue15881#msg170215
22
+try:
23
+    import multiprocessing  # noqa
24
+except ImportError:
25
+    pass
26
+
27
+setuptools.setup(
28
+    setup_requires=['pbr>=2.0.0'],
29
+    pbr=True)

+ 86
- 0
tasks/main.yml View File

@@ -0,0 +1,86 @@
1
+---
2
+# Copyright 2017, Rackspace US, Inc.
3
+#
4
+# Licensed under the Apache License, Version 2.0 (the "License");
5
+# you may not use this file except in compliance with the License.
6
+# You may obtain a copy of the License at
7
+#
8
+#     http://www.apache.org/licenses/LICENSE-2.0
9
+#
10
+# Unless required by applicable law or agreed to in writing, software
11
+# distributed under the License is distributed on an "AS IS" BASIS,
12
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+# See the License for the specific language governing permissions and
14
+# limitations under the License.
15
+
16
+- name: Create systemd-networkd directory
17
+  file:
18
+    path: "/etc/systemd/network"
19
+    state: directory
20
+  tags:
21
+    - systemd-networkd
22
+
23
+- name: Create systemd-networkd link
24
+  config_template:
25
+    src: "systemd-network-link.j2"
26
+    dest: "/etc/systemd/network/99-default.link"
27
+    owner: "root"
28
+    group: "root"
29
+    mode: "0644"
30
+    config_overrides: "{{ systemd_link_config_overrides }}"
31
+    config_type: "ini"
32
+  tags:
33
+    - systemd-networkd
34
+
35
+- name: Run interface cleanup script
36
+  command: "/usr/local/bin/interface-cleanup"
37
+  failed_when: false
38
+  when:
39
+    - systemd_interface_cleanup | bool
40
+  tags:
41
+    - systemd-networkd
42
+
43
+- name: Create systemd-networkd interface cleanup script
44
+  template:
45
+    src: "interface-cleanup.sh.j2"
46
+    dest: "/usr/local/bin/interface-cleanup"
47
+    owner: "root"
48
+    group: "root"
49
+    mode: "0750"
50
+  when:
51
+    - systemd_interface_cleanup | bool
52
+  tags:
53
+    - systemd-networkd
54
+
55
+- name: Create systemd-networkd network device(s)
56
+  template:
57
+    src: "systemd-netdev.j2"
58
+    dest: "/etc/systemd/network/{{ item.0 }}-{{ item.1.NetDev.Name }}.netdev"
59
+    owner: "root"
60
+    group: "root"
61
+    mode: "0644"
62
+  with_indexed_items: "{{ systemd_netdevs }}"
63
+  tags:
64
+    - systemd-networkd
65
+
66
+- name: Create systemd-networkd network(s)
67
+  config_template:
68
+    src: "systemd-network.j2"
69
+    dest: "/etc/systemd/network/{{ item.0 }}-{{ item.1.interface }}.network"
70
+    owner: "root"
71
+    group: "root"
72
+    mode: "0644"
73
+    config_overrides: "{{ item.1.config_overrides | default({}) }}"
74
+    config_type: "ini"
75
+  with_indexed_items: "{{ systemd_networks }}"
76
+  tags:
77
+    - systemd-networkd
78
+
79
+- name: Restart systemd-networkd
80
+  systemd:
81
+    name: "systemd-networkd"
82
+    daemon_reload: yes
83
+    enabled: "{{ (systemd_run_networkd | bool) | ternary('yes', 'no') }}"
84
+    state: "{{ (systemd_run_networkd | bool) | ternary('restarted', omit) }}"
85
+  tags:
86
+    - systemd-networkd

+ 15
- 0
templates/interface-cleanup.sh.j2 View File

@@ -0,0 +1,15 @@
1
+#!/usr/bin/env bash
2
+
3
+# {{ ansible_managed }}
4
+
5
+{% for item in systemd_netdevs %}
6
+if [[ -f "/etc/systemd/network/{{ loop.index }}-{{ item.NetDev.Name }}.netdev" ]]; then
7
+  rm -f "/etc/systemd/network/{{ loop.index }}-{{ item.NetDev.Name }}.netdev"
8
+fi
9
+{% endfor %}
10
+
11
+{% for item in systemd_networks %}
12
+if [[ -f "/etc/systemd/network/{{ loop.index }}-{{ item.interface }}.network" ]]; then
13
+  rm -f "/etc/systemd/network/{{ loop.index }}-{{ item.interface }}.network"
14
+fi
15
+{% endfor %}

+ 9
- 0
templates/systemd-netdev.j2 View File

@@ -0,0 +1,9 @@
1
+# {{ ansible_managed }}
2
+
3
+{% for key, values in item.1.items() %}
4
+[{{ key }}]
5
+{%   for k, v in values.items() %}
6
+{{ k }}={{ v }}
7
+{%   endfor %}
8
+
9
+{% endfor %}

+ 4
- 0
templates/systemd-network-link.j2 View File

@@ -0,0 +1,4 @@
1
+# {{ ansible_managed }}
2
+
3
+[Link]
4
+MACAddressPolicy=persistent

+ 49
- 0
templates/systemd-network.j2 View File

@@ -0,0 +1,49 @@
1
+# {{ ansible_managed }}
2
+
3
+[Match]
4
+Name={{ item.1.interface }}
5
+
6
+{% if item.1.address is defined %}
7
+[Address]
8
+{%   set addr_cidr = (item.1.address | string + '/' + item.1.netmask | string) | ipaddr('prefix') %}
9
+Address={{ item.1.address }}/{{ addr_cidr }}
10
+{% elif item.1.address is defined and (item.1.address | lower) == 'dhcp' %}
11
+[DHCP]
12
+UseDNS={{ (item.1.usedns | default(false) | bool) | ternary('yes', 'no') }}
13
+UseNTP=yes
14
+RouteMetric=20
15
+{% endif %}
16
+
17
+{% for route in item.1.static_routes | default([]) %}
18
+[Route]
19
+Source={{ route['cidr'] }}
20
+Gateway={{ route['gateway'] }}
21
+Metric={{ 20 + loop.index }}
22
+
23
+{% endfor %}
24
+[Network]
25
+{% if item.1.address is defined %}
26
+{%   set addr_cidr = (item.1.address | string + '/' + item.1.netmask | string) | ipaddr('prefix') %}
27
+Address={{ item.1.address }}/{{ addr_cidr }}
28
+{% elif item.1.address is defined and (item.1.address | lower) == 'dhcp' %}
29
+DHCP=yes
30
+{% endif %}
31
+{% if item.1.address is defined and item.1.gateway is defined %}
32
+Gateway={{ item.1.gateway }}
33
+{% endif %}
34
+{% if item.1.bridge is defined %}
35
+Bridge={{ item.1.bridge }}
36
+{% elif item.1.bond is defined %}
37
+Bond={{ item.1.bond }}
38
+{% elif item.1.vlan is defined %}
39
+VLAN={{ item.1.vlan }}
40
+{% elif item.1.macvlan is defined %}
41
+MACVLAN={{ item.1.macvlan }}
42
+{% elif item.1.vxlan is defined %}
43
+VXLAN={{ item.1.vxlan }}
44
+{% endif %}
45
+
46
+[Link]
47
+{% if item.1.mtu is defined %}
48
+MTUBytes={{ item.1.mtu }}
49
+{% endif %}

+ 17
- 0
test-requirements.txt View File

@@ -0,0 +1,17 @@
1
+# The order of packages is significant, because pip processes them in the order
2
+# of appearance. Changing the order has an impact on the overall integration
3
+# process, which may cause wedges in the gate later.
4
+bashate>=0.2 # Apache-2.0
5
+flake8<2.6.0,>=2.5.4 # MIT
6
+pyasn1 # BSD
7
+pyOpenSSL>=0.14 # Apache-2.0
8
+requests!=2.12.2,!=2.13.0,>=2.10.0 # Apache-2.0
9
+ndg-httpsclient>=0.4.2;python_version<'3.0' # BSD
10
+
11
+# this is required for the docs build jobs
12
+sphinx!=1.6.1,>=1.5.1 # BSD
13
+oslosphinx>=4.7.0 # Apache-2.0
14
+openstackdocstheme>=1.5.0 # Apache-2.0
15
+doc8 # Apache-2.0
16
+reno>=1.8.0 # Apache-2.0
17
+sphinxmark>=0.1.14 # Apache-2.0

+ 1
- 0
tests/ansible-role-requirements.yaml View File

@@ -0,0 +1 @@
1
+../ansible-role-requirements.yaml

+ 27
- 0
tests/group_vars/all_containers.yml View File

@@ -0,0 +1,27 @@
1
+---
2
+# Copyright 2018, Rackspace US, Inc.
3
+#
4
+# Licensed under the Apache License, Version 2.0 (the "License");
5
+# you may not use this file except in compliance with the License.
6
+# You may obtain a copy of the License at
7
+#
8
+#     http://www.apache.org/licenses/LICENSE-2.0
9
+#
10
+# Unless required by applicable law or agreed to in writing, software
11
+# distributed under the License is distributed on an "AS IS" BASIS,
12
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+# See the License for the specific language governing permissions and
14
+# limitations under the License.
15
+
16
+container_name: "{{ inventory_hostname }}"
17
+container_networks:
18
+  management_address:
19
+    address: "{{ ansible_host }}"
20
+    bridge: "br-mgmt"
21
+    interface: "eth1"
22
+    netmask: "255.255.255.0"
23
+    type: "veth"
24
+
25
+physical_host: localhost
26
+properties:
27
+  service_name: "{{ inventory_hostname }}"

+ 27
- 0
tests/host_vars/localhost.yml View File

@@ -0,0 +1,27 @@
1
+---
2
+# Copyright 2018, Rackspace US, Inc.
3
+#
4
+# Licensed under the Apache License, Version 2.0 (the "License");
5
+# you may not use this file except in compliance with the License.
6
+# You may obtain a copy of the License at
7
+#
8
+#     http://www.apache.org/licenses/LICENSE-2.0
9
+#
10
+# Unless required by applicable law or agreed to in writing, software
11
+# distributed under the License is distributed on an "AS IS" BASIS,
12
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+# See the License for the specific language governing permissions and
14
+# limitations under the License.
15
+
16
+neutron_provider_networks:
17
+  network_types: "vxlan,flat"
18
+  network_mappings: "flat:eth12"
19
+  network_vxlan_ranges: "1:1000"
20
+
21
+neutron_local_ip:  10.1.2.1
22
+
23
+ansible_python_interpreter: "/usr/bin/python2"
24
+
25
+bridges:
26
+  - name: "br-mgmt"
27
+    ip_addr: "10.1.1.1"

+ 2
- 0
tests/inventory View File

@@ -0,0 +1,2 @@
1
+[all]
2
+localhost

+ 26
- 0
tests/systemd_init-overrides.yml View File

@@ -0,0 +1,26 @@
1
+---
2
+# Copyright 2018, Rackspace US, Inc.
3
+#
4
+# Licensed under the Apache License, Version 2.0 (the "License");
5
+# you may not use this file except in compliance with the License.
6
+# You may obtain a copy of the License at
7
+#
8
+#     http://www.apache.org/licenses/LICENSE-2.0
9
+#
10
+# Unless required by applicable law or agreed to in writing, software
11
+# distributed under the License is distributed on an "AS IS" BASIS,
12
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+# See the License for the specific language governing permissions and
14
+# limitations under the License.
15
+
16
+tempest_run: yes
17
+tempest_venv_tag: "{{ tempest_git_install_branch }}"
18
+tempest_venv_bin: "/opt/tempest_{{ tempest_venv_tag }}/bin"
19
+tempest_log_dir: "/var/log/"
20
+tempest_test_whitelist:
21
+  - tempest.scenario.test_server_basic_ops.TestServerBasicOps.test_server_basic_ops
22
+
23
+neutron_provider_networks:
24
+  network_types: "vxlan,flat"
25
+  network_mappings: "flat:eth12"
26
+  network_vxlan_ranges: "1:1000"

+ 19
- 0
tests/test.yml View File

@@ -0,0 +1,19 @@
1
+---
2
+# Copyright 2018, Rackspace US, Inc.
3
+#
4
+# Licensed under the Apache License, Version 2.0 (the "License");
5
+# you may not use this file except in compliance with the License.
6
+# You may obtain a copy of the License at
7
+#
8
+#     http://www.apache.org/licenses/LICENSE-2.0
9
+#
10
+# Unless required by applicable law or agreed to in writing, software
11
+# distributed under the License is distributed on an "AS IS" BASIS,
12
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+# See the License for the specific language governing permissions and
14
+# limitations under the License.
15
+
16
+- hosts: localhost
17
+  gather_facts: true
18
+  tasks:
19
+    - debug: msg=testing

+ 113
- 0
tox.ini View File

@@ -0,0 +1,113 @@
1
+[tox]
2
+minversion = 2.0
3
+skipsdist = True
4
+envlist = docs,linters,functional
5
+
6
+
7
+[testenv]
8
+usedevelop = True
9
+install_command =
10
+    pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
11
+deps =
12
+    -r{toxinidir}/test-requirements.txt
13
+commands =
14
+    /usr/bin/find . -type f -name "*.pyc" -delete
15
+passenv =
16
+    HOME
17
+    http_proxy
18
+    HTTP_PROXY
19
+    https_proxy
20
+    HTTPS_PROXY
21
+    no_proxy
22
+    NO_PROXY
23
+whitelist_externals =
24
+    bash
25
+setenv =
26
+    PYTHONUNBUFFERED=1
27
+    ROLE_NAME=systemd_networkd
28
+    TEST_IDEMPOTENCE=false
29
+    VIRTUAL_ENV={envdir}
30
+    WORKING_DIR={toxinidir}
31
+
32
+
33
+[testenv:docs]
34
+commands=
35
+    bash -c "rm -rf doc/build"
36
+    doc8 doc
37
+    python setup.py build_sphinx
38
+
39
+
40
+[doc8]
41
+# Settings for doc8:
42
+extensions = .rst
43
+
44
+
45
+[testenv:releasenotes]
46
+commands =
47
+    sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
48
+
49
+
50
+# environment used by the -infra templated docs job
51
+[testenv:venv]
52
+commands =
53
+    {posargs}
54
+
55
+
56
+[testenv:pep8]
57
+commands =
58
+    bash -c "{toxinidir}/tests/tests-repo-clone.sh"
59
+    bash -c "{toxinidir}/tests/common/test-pep8.sh"
60
+
61
+
62
+[flake8]
63
+# Ignores the following rules due to how ansible modules work in general
64
+#     F403 'from ansible.module_utils.basic import *' used;
65
+#          unable to detect undefined names
66
+ignore=F403
67
+
68
+
69
+[testenv:bashate]
70
+commands =
71
+    bash -c "{toxinidir}/tests/tests-repo-clone.sh"
72
+    bash -c "{toxinidir}/tests/common/test-bashate.sh"
73
+
74
+
75
+[testenv:ansible]
76
+deps =
77
+    {[testenv]deps}
78
+    -rhttps://git.openstack.org/cgit/openstack/openstack-ansible-tests/plain/test-ansible-deps.txt
79
+
80
+
81
+[testenv:ansible-syntax]
82
+deps =
83
+    {[testenv:ansible]deps}
84
+commands =
85
+    bash -c "{toxinidir}/tests/tests-repo-clone.sh"
86
+    bash -c "{toxinidir}/tests/common/test-ansible-syntax.sh"
87
+
88
+
89
+[testenv:ansible-lint]
90
+deps =
91
+    {[testenv:ansible]deps}
92
+commands =
93
+    bash -c "{toxinidir}/tests/tests-repo-clone.sh"
94
+    bash -c "{toxinidir}/tests/common/test-ansible-lint.sh"
95
+
96
+
97
+[testenv:functional]
98
+deps =
99
+    {[testenv:ansible]deps}
100
+commands =
101
+    bash -c "{toxinidir}/tests/tests-repo-clone.sh"
102
+    bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"
103
+
104
+
105
+[testenv:linters]
106
+deps =
107
+    {[testenv:ansible]deps}
108
+commands =
109
+    {[testenv:pep8]commands}
110
+    {[testenv:bashate]commands}
111
+    {[testenv:ansible-lint]commands}
112
+    {[testenv:ansible-syntax]commands}
113
+    {[testenv:docs]commands}

Loading…
Cancel
Save