-
Notifications
You must be signed in to change notification settings - Fork 254
/
categ_ansible_test_code.txt
8092 lines (6706 loc) · 297 KB
/
categ_ansible_test_code.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
===========Repository Name===========
ansible-role-container-registry
===========File Path===========
C:\Users\mehedi.md.hasan\PythonWorkspace\OSTK_ANSI\ostk-ansi\ansible-role-container-registry\tox.ini
===========File Type===========
.ini
===========File Content===========
[tox]
minversion = 1.6
envlist = docs, linters
skipdist = True
[testenv]
usedevelop = True
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
setenv = VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/test-requirements.txt
whitelist_externals = bash
[testenv:bindep]
basepython = python3
# Do not install any requirements. We want this to be fast and work even if
# system dependencies are missing, since it's used to tell you what system
# dependencies are missing! This also means that bindep must be installed
# separately, outside of the requirements files.
deps = bindep
commands = bindep test
[testenv:pep8]
basepython = python3
commands =
# Run hacking/flake8 check for all python files
bash -c "git ls-files | grep -v releasenotes | xargs grep --binary-files=without-match \
--files-with-match '^.!.*python$' \
--exclude-dir .tox \
--exclude-dir .git \
--exclude-dir .eggs \
--exclude-dir *.egg-info \
--exclude-dir dist \
--exclude-dir *lib/python* \
--exclude-dir doc \
| xargs flake8 --verbose"
[testenv:ansible-lint]
basepython=python3
commands =
bash ci-scripts/ansible-lint.sh
[testenv:linters]
basepython = python3
deps =
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/ansible-requirements.txt
commands =
{[testenv:pep8]commands}
{[testenv:ansible-lint]commands}
[testenv:releasenotes]
basepython = python3
whitelist_externals = bash
commands = bash -c ci-scripts/releasenotes_tox.sh
[testenv:venv]
basepython = python3
commands = {posargs}
[flake8]
# E123, E125 skipped as they are invalid PEP-8.
# E265 deals withs paces inside of comments
show-source = True
ignore = E123,E125,E265
builtins = _
===========Repository Name===========
ansible-role-container-registry
===========File Path===========
C:\Users\mehedi.md.hasan\PythonWorkspace\OSTK_ANSI\ostk-ansi\ansible-role-container-registry\tests\inventory
===========File Type===========
===========File Content===========
localhost
===========Repository Name===========
ansible-role-container-registry
===========File Path===========
C:\Users\mehedi.md.hasan\PythonWorkspace\OSTK_ANSI\ostk-ansi\ansible-role-container-registry\tests\test.yml
===========File Type===========
.yml
===========File Content===========
- hosts: localhost
become: true
roles:
- container-registry
===========Repository Name===========
ansible-role-python_venv_build
===========File Path===========
C:\Users\mehedi.md.hasan\PythonWorkspace\OSTK_ANSI\ostk-ansi\ansible-role-python_venv_build\tox.ini
===========File Type===========
.ini
===========File Content===========
[tox]
minversion = 2.0
skipsdist = True
envlist = docs,linters,functional
[testenv]
usedevelop = True
install_command =
pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
commands =
/usr/bin/find . -type f -name "*.pyc" -delete
passenv =
COMMON_TESTS_PATH
HOME
http_proxy
HTTP_PROXY
https_proxy
HTTPS_PROXY
no_proxy
NO_PROXY
TESTING_BRANCH
TESTING_HOME
USER
whitelist_externals =
bash
setenv =
PYTHONUNBUFFERED=1
ROLE_NAME=python_venv_build
VIRTUAL_ENV={envdir}
WORKING_DIR={toxinidir}
# TODO(odyssey4me): remove after debugging is completed
ANSIBLE_PARAMETERS=-v
[testenv:docs]
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt
commands=
bash -c "rm -rf doc/build"
doc8 doc
sphinx-build -b html doc/source doc/build/html
[doc8]
# Settings for doc8:
extensions = .rst
[testenv:releasenotes]
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt
commands =
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
# environment used by the -infra templated docs job
[testenv:venv]
basepython = python3
commands =
{posargs}
[testenv:pep8]
basepython = python3
commands =
bash -c "{toxinidir}/tests/common/test-pep8.sh"
[flake8]
# Ignores the following rules due to how ansible modules work in general
# F403 'from ansible.module_utils.basic import *' used;
# unable to detect undefined names
ignore=F403
[testenv:bashate]
commands =
bash -c "{toxinidir}/tests/common/test-bashate.sh"
# The deps URL should be set to the appropriate git URL.
# In the tests repo itself, the variable is uniquely set to
# the toxinidir so that the role is able to test itself, but
# the tox config is exactly the same as other repositories.
#
# The value for other repositories must be:
# http://git.openstack.org/cgit/openstack/openstack-ansible-tests/plain/test-ansible-deps.txt
# or for a stable branch:
# http://git.openstack.org/cgit/openstack/openstack-ansible-tests/plain/test-ansible-deps.txt?h=stable/queens
[testenv:ansible-syntax]
commands =
bash -c "{toxinidir}/tests/common/test-ansible-syntax.sh"
[testenv:ansible-lint]
commands =
bash -c "{toxinidir}/tests/common/test-ansible-lint.sh"
[testenv:functional]
commands =
bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"
[testenv:linters]
basepython = python3
commands =
bash -c "{toxinidir}/tests/common/test-ansible-env-prep.sh"
{[testenv:pep8]commands}
{[testenv:bashate]commands}
{[testenv:ansible-lint]commands}
{[testenv:ansible-syntax]commands}
===========Repository Name===========
ansible-role-python_venv_build
===========File Path===========
C:\Users\mehedi.md.hasan\PythonWorkspace\OSTK_ANSI\ostk-ansi\ansible-role-python_venv_build\tests\ansible-role-requirements.yml
===========File Type===========
.yml
===========File Content===========
- name: apt_package_pinning
src: https://git.openstack.org/openstack/openstack-ansible-apt_package_pinning
scm: git
version: master
- name: pip_install
src: https://git.openstack.org/openstack/openstack-ansible-pip_install
scm: git
version: master
- name: openstack_hosts
src: https://git.openstack.org/openstack/openstack-ansible-openstack_hosts
scm: git
version: master
- name: lxc_hosts
src: https://git.openstack.org/openstack/openstack-ansible-lxc_hosts
scm: git
version: master
- name: lxc_container_create
src: https://git.openstack.org/openstack/openstack-ansible-lxc_container_create
scm: git
version: master
===========Repository Name===========
ansible-role-python_venv_build
===========File Path===========
C:\Users\mehedi.md.hasan\PythonWorkspace\OSTK_ANSI\ostk-ansi\ansible-role-python_venv_build\tests\inventory
===========File Type===========
===========File Content===========
[all]
localhost
container1
container2
container3
[all_containers]
container1
container2
container3
===========Repository Name===========
ansible-role-python_venv_build
===========File Path===========
C:\Users\mehedi.md.hasan\PythonWorkspace\OSTK_ANSI\ostk-ansi\ansible-role-python_venv_build\tests\test.yml
===========File Type===========
.yml
===========File Content===========
---
# Copyright 2018, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Prepare the host/containers
import_playbook: common/test-setup-host.yml
- name: Prepare web server on localhost to serve python packages
hosts: localhost
connection: local
become: yes
any_errors_fatal: yes
tasks:
- name: Set venv_build_archive_path and venv_install_source_path
set_fact:
venv_build_host_wheel_path: >-
{%- if ansible_distribution == "Ubuntu" %}
{%- set _path = "/var/www/html" %}
{%- elif ansible_distribution == "CentOS" %}
{%- set _path = "/usr/share/nginx/html" %}
{%- else %}
{%- set _path = "/srv/www/htdocs" %}
{%- endif %}
{{- _path }}
- name: Install EPEL gpg keys
rpm_key:
key: "http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7"
state: present
when:
- ansible_pkg_mgr in ['yum', 'dnf']
register: _add_yum_keys
until: _add_yum_keys is success
retries: 5
delay: 2
- name: Install the EPEL repository
yum_repository:
name: epel-nginx
baseurl: "{{ (centos_epel_mirror | default ('http://download.fedoraproject.org/pub/epel')) ~ '/' ~ ansible_distribution_major_version ~ '/' ~ ansible_architecture }}"
description: 'Extra Packages for Enterprise Linux 7 - $basearch'
gpgcheck: yes
enabled: yes
state: present
includepkgs: 'nginx*'
when:
- ansible_pkg_mgr in ['yum', 'dnf']
register: install_epel_repo
until: install_epel_repo is success
retries: 5
delay: 2
- name: Install distro packages
package:
name: "nginx"
update_cache: "{{ (ansible_pkg_mgr in ['apt', 'zypper']) | ternary('yes', omit) }}"
register: install
until: install is success
retries: 5
delay: 2
- name: Enable and start nginx
service:
name: nginx
enabled: yes
daemon_reload: yes
state: restarted
- name: Verify not using a build host
hosts: "container1"
remote_user: root
any_errors_fatal: yes
vars:
venv_pip_packages:
- "Jinja2==2.10"
venv_install_destination_path: "/openstack/venvs/test-venv"
tasks:
- name: Execute venv install
include_role:
name: "python_venv_build"
private: yes
vars:
venv_facts_when_changed:
- section: "{{ inventory_hostname }}"
option: "test"
value: True
- name: refresh local facts
setup:
filter: ansible_local
gather_subset: "!all"
- name: Show the ansible_local facts
debug:
var: ansible_local
- name: Verify that the facts were set
assert:
that:
- ansible_local['openstack_ansible'][inventory_hostname]['test'] | bool
- name: Find files/folders on targets
find:
file_type: directory
get_checksum: no
recurse: no
paths:
- "{{ venv_install_destination_path | dirname }}"
register: _target_folders
- name: Compile the folder list from the targets
set_fact:
_target_folder_list: "{{ _target_folders['files'] | map(attribute='path') | list }}"
- name: Show the files/folder from the targets
debug:
var: _target_folder_list
- name: Verify the folder list from the targets
assert:
that:
- "{{ venv_install_destination_path in _target_folder_list }}"
- name: Verify using a build host
hosts: "container2:container3"
remote_user: root
any_errors_fatal: yes
vars:
venv_default_pip_packages:
- "elasticsearch>=6.0.0,<7.0.0"
venv_pip_packages:
- "Jinja2==2.10"
venv_install_destination_path: "/openstack/venvs/test-venv"
venv_pip_install_args: >-
--find-links http://{{ hostvars['localhost'].ansible_default_ipv4.address }}
--trusted-host {{ hostvars['localhost'].ansible_default_ipv4.address }}
venv_build_host: localhost
venv_build_host_wheel_path: "{{ hostvars['localhost']['venv_build_host_wheel_path'] }}"
tasks:
- name: Execute venv install
include_role:
name: "python_venv_build"
private: yes
vars:
venv_facts_when_changed:
- section: "{{ inventory_hostname }}"
option: "test"
value: True
- name: refresh local facts
setup:
filter: ansible_local
gather_subset: "!all"
- name: Show the ansible_local facts
debug:
var: ansible_local
- name: Verify that the facts were set
assert:
that:
- ansible_local['openstack_ansible'][inventory_hostname]['test'] | bool
- name: Find files/folders on targets
find:
file_type: directory
get_checksum: no
recurse: no
paths:
- "{{ venv_install_destination_path | dirname }}"
register: _target_folders
- name: Compile the folder list from the targets
set_fact:
_target_folder_list: "{{ _target_folders['files'] | map(attribute='path') | list }}"
- name: Show the files/folder from the targets
debug:
var: _target_folder_list
- name: Verify the folder list from the targets
assert:
that:
- "{{ venv_install_destination_path in _target_folder_list }}"
-----------> External dependency ... import_playbook: common/test-setup-host.yml ... dependent playbook is not in 'test' folder but in 'common' folder
-----------> Follows a 'prepare' and 'verify' principle
===========Repository Name===========
ansible-role-systemd_mount
===========File Path===========
C:\Users\mehedi.md.hasan\PythonWorkspace\OSTK_ANSI\ostk-ansi\ansible-role-systemd_mount\tox.ini
===========File Type===========
.ini
===========File Content===========
[tox]
minversion = 2.0
skipsdist = True
envlist = docs,linters,functional
[testenv]
usedevelop = True
install_command =
pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
commands =
/usr/bin/find . -type f -name "*.pyc" -delete
passenv =
COMMON_TESTS_PATH
HOME
http_proxy
HTTP_PROXY
https_proxy
HTTPS_PROXY
no_proxy
NO_PROXY
TESTING_BRANCH
TESTING_HOME
USER
whitelist_externals =
bash
setenv =
PYTHONUNBUFFERED=1
ROLE_NAME=systemd_mount
TEST_IDEMPOTENCE=false
VIRTUAL_ENV={envdir}
WORKING_DIR={toxinidir}
[testenv:docs]
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt
commands=
bash -c "rm -rf doc/build"
doc8 doc
sphinx-build -b html doc/source doc/build/html
[doc8]
# Settings for doc8:
extensions = .rst
[testenv:releasenotes]
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt
commands =
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
# environment used by the -infra templated docs job
[testenv:venv]
basepython = python3
commands =
{posargs}
[testenv:pep8]
basepython = python3
commands =
bash -c "{toxinidir}/tests/common/test-pep8.sh"
[flake8]
# Ignores the following rules due to how ansible modules work in general
# F403 'from ansible.module_utils.basic import *' used;
# unable to detect undefined names
ignore=F403
[testenv:bashate]
commands =
bash -c "{toxinidir}/tests/common/test-bashate.sh"
[testenv:ansible-syntax]
commands =
bash -c "{toxinidir}/tests/common/test-ansible-syntax.sh"
[testenv:ansible-lint]
commands =
bash -c "{toxinidir}/tests/common/test-ansible-lint.sh"
[testenv:functional]
commands =
bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"
[testenv:linters]
basepython = python3
commands =
bash -c "{toxinidir}/tests/common/test-ansible-env-prep.sh"
{[testenv:pep8]commands}
{[testenv:bashate]commands}
{[testenv:ansible-lint]commands}
{[testenv:ansible-syntax]commands}
{[testenv:docs]commands}
===========Repository Name===========
ansible-role-systemd_mount
===========File Path===========
C:\Users\mehedi.md.hasan\PythonWorkspace\OSTK_ANSI\ostk-ansi\ansible-role-systemd_mount\tests\ansible-role-requirements.yaml
===========File Type===========
.yaml
===========File Content===========
===========Repository Name===========
ansible-role-systemd_mount
===========File Path===========
C:\Users\mehedi.md.hasan\PythonWorkspace\OSTK_ANSI\ostk-ansi\ansible-role-systemd_mount\tests\inventory
===========File Type===========
===========File Content===========
[all]
localhost
===========Repository Name===========
ansible-role-systemd_mount
===========File Path===========
C:\Users\mehedi.md.hasan\PythonWorkspace\OSTK_ANSI\ostk-ansi\ansible-role-systemd_mount\tests\systemd_init-overrides.yml
===========File Type===========
.yml
===========File Content===========
---
# Copyright 2018, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
tempest_run: yes
tempest_venv_tag: "{{ tempest_git_install_branch }}"
tempest_venv_bin: "/opt/tempest_{{ tempest_venv_tag }}/bin"
tempest_log_dir: "/var/log/"
tempest_test_whitelist:
- tempest.scenario.test_server_basic_ops.TestServerBasicOps.test_server_basic_ops
neutron_provider_networks:
network_types: "vxlan,flat"
network_mappings: "flat:eth12"
network_vxlan_ranges: "1:1000"
===========Repository Name===========
ansible-role-systemd_mount
===========File Path===========
C:\Users\mehedi.md.hasan\PythonWorkspace\OSTK_ANSI\ostk-ansi\ansible-role-systemd_mount\tests\test-create-btrfs-dev.yml
===========File Type===========
.yml
===========File Content===========
---
# Copyright 2017, BBC R&D
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Configure BTRFS sparse file
hosts: localhost
user: root
become: true
connection: local
tasks:
- name: Install BTRFS packages
package:
name: "{{ btrfs_package[ansible_pkg_mgr | lower] }}"
state: present
- name: Create base directories
file:
path: "/var/lib"
state: "directory"
- name: Create sparse file
command: "truncate -s 1024G /var/lib/sparse-file.img"
args:
creates: /var/lib/sparse-file.img
register: sparse_file
- name: Format the sparse file
filesystem:
fstype: btrfs
dev: /var/lib/sparse-file.img
when:
- sparse_file is changed
vars:
btrfs_package:
apt: "btrfs-tools"
yum: "btrfs-progs"
zypper: "btrfsprogs"
-----------> Does not follow a 'prepare' and 'verify' principle
===========Repository Name===========
ansible-role-systemd_mount
===========File Path===========
C:\Users\mehedi.md.hasan\PythonWorkspace\OSTK_ANSI\ostk-ansi\ansible-role-systemd_mount\tests\test-create-nfs-dev.yml
===========File Type===========
.yml
===========File Content===========
---
# Copyright 2017, BBC R&D
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Create an NFS backing store
hosts: localhost
user: root
become: true
connection: local
tasks:
- name: Install NFS packages
package:
name: "{{ nfs_package[ansible_distribution.split()[0] | lower] }}"
state: present
- name: create the system group for nfs
group:
name: "nfs-user"
gid: "10000"
state: "present"
system: "yes"
- name: Create the system user for nfs
user:
name: "nfs-user"
uid: "10000"
group: "nfs-user"
comment: "nfs-user"
shell: "/bin/false"
system: "yes"
createhome: "yes"
home: "/srv/nfs"
- name: Create base directories
file:
path: "{{ item }}"
state: "directory"
owner: "nfs-user"
group: "nfs-user"
with_items:
- "/srv/nfs/test"
- name: Create exports file
lineinfile:
path: /etc/exports
line: '{{ item }} 127.0.0.1/255.0.0.0(rw,sync,no_subtree_check,insecure,all_squash,anonuid=10000,anongid=10000)'
owner: root
group: root
mode: 0644
create: yes
with_items:
- "/srv/nfs/test"
register: nfs_exportfs
- name: Restart nfs-server
systemd:
daemon_reload: yes
name: "nfs-server"
enabled: "yes"
state: "restarted"
when:
- nfs_exportfs is changed
- name: Export NFS
command: exportfs -rav
tags:
- skip_ansible_lint
vars:
nfs_package:
ubuntu: "nfs-kernel-server"
centos: "nfs-utils"
opensuse: "nfs-kernel-server"
-----------> Does not follow a 'prepare' and 'verify' principle ... we don't see any assert statements in any of the tasks
===========Repository Name===========
ansible-role-systemd_mount
===========File Path===========
C:\Users\mehedi.md.hasan\PythonWorkspace\OSTK_ANSI\ostk-ansi\ansible-role-systemd_mount\tests\test-create-swap-dev.yml
===========File Type===========
.yml
===========File Content===========
---
# Copyright 2017, BBC R&D
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Configure swap sparse file
hosts: localhost
user: root
become: true
connection: local
tasks:
- name: Create swap file
command: "dd if=/dev/zero of=/var/lib/test-swap.img bs=1M count=128"
args:
creates: /var/lib/test-swap.img
register: create_swap
- name: Format the swap file
command: mkswap /var/lib/test-swap.img
failed_when: false
when:
- create_swap is changed
-----------> Does not follow a 'prepare' and 'verify' principle ... no assert to verify configuration of swap sparse file
===========Repository Name===========
ansible-role-systemd_mount
===========File Path===========
C:\Users\mehedi.md.hasan\PythonWorkspace\OSTK_ANSI\ostk-ansi\ansible-role-systemd_mount\tests\test.yml
===========File Type===========
.yml
===========File Content===========
---
# Copyright 2018, Rackspace US, Inc.
# Copyright 2018, Logan Vig <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- import_playbook: test-create-swap-dev.yml
- import_playbook: test-create-nfs-dev.yml
- import_playbook: test-create-btrfs-dev.yml
- name: Playbook for role testing
hosts: localhost
connection: local
user: root
become: true
roles:
- role: "systemd_mount"
post_tasks:
- name: Ensure mount are mounted
command: grep -w '{{ item }}' /proc/mounts
with_items:
- /var/lib/sparse-file
- /var/lib/test
tags:
- skip_ansible_lint
- name: Ensure swap is enabled
shell: swapon | grep -w '/var/lib/test-swap.img'
tags:
- skip_ansible_lint
vars:
systemd_mounts:
- what: '/var/lib/sparse-file.img'
where: '/var/lib/sparse-file'
type: 'btrfs'
options: 'loop'
state: 'started'
enabled: true
config_overrides:
Unit:
ConditionPathExists: '/var/lib/sparse-file.img'
- what: "/var/lib/test-swap.img"
priority: "0"
options: "%%"
type: "swap"
state: 'started'
enabled: true
- what: "127.0.0.1:/srv/nfs/test"
where: "/var/lib/test"
type: "nfs"
options: "_netdev,auto"
state: 'started'
enabled: true
config_overrides:
Unit:
After:
? network.target
? network-online.target
Wants: network-online.target
===========Repository Name===========
ansible-role-systemd_networkd
===========File Path===========
C:\Users\mehedi.md.hasan\PythonWorkspace\OSTK_ANSI\ostk-ansi\ansible-role-systemd_networkd\tox.ini
===========File Type===========
.ini
===========File Content===========
[tox]
minversion = 2.0
skipsdist = True
envlist = docs,linters,functional
[testenv]
usedevelop = True
install_command =
pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
commands =
/usr/bin/find . -type f -name "*.pyc" -delete
passenv =
COMMON_TESTS_PATH
HOME
http_proxy
HTTP_PROXY
https_proxy
HTTPS_PROXY
no_proxy
NO_PROXY
TESTING_BRANCH
TESTING_HOME
USER
whitelist_externals =
bash
setenv =
PYTHONUNBUFFERED=1
ROLE_NAME=systemd_networkd
TEST_IDEMPOTENCE=false
VIRTUAL_ENV={envdir}
WORKING_DIR={toxinidir}
[testenv:docs]
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt
commands=
bash -c "rm -rf doc/build"
doc8 doc
sphinx-build -b html doc/source doc/build/html