├── .fixtures.yml ├── .gitattributes ├── .gitignore ├── .project ├── .rebuildbot.sh ├── .rspec ├── .rubocop.yml ├── .rubocop_todo.yml ├── .ruby-version ├── .sync.yml ├── .travis.yml ├── CHANGELOG.md ├── CONTRIBUTING.md ├── CONTRIBUTORS ├── Gemfile ├── Guardfile ├── LICENSE ├── MAINTAINERS.md ├── NOTICE ├── README.markdown ├── Rakefile ├── appveyor.yml ├── files ├── .gitkeep ├── chrony.conf └── mozilla-profilemanager.desktop ├── lib └── puppet │ ├── provider │ └── .gitkeep │ └── type │ └── .gitkeep ├── locales └── config.yaml ├── manifests ├── all.pp ├── base_packages.pp ├── chrony.pp ├── cronie.pp ├── cups.pp ├── dkms.pp ├── docker.pp ├── init.pp ├── kde.pp ├── makepkg.pp ├── networkmanager.pp ├── pacman_repo.pp ├── repos │ ├── jantman.pp │ └── multilib.pp ├── sddm.pp ├── ssh.pp ├── sudo.pp ├── template.txt ├── userapps │ ├── rvm.pp │ └── virtualbox.pp └── xorg.pp ├── metadata.json ├── spec ├── acceptance │ ├── classes │ │ ├── 0_init_spec.rb │ │ ├── 1_xorg_spec.rb │ │ ├── base_packages_spec.rb │ │ ├── chrony_spec.rb │ │ ├── cronie_spec.rb │ │ ├── cups_spec.rb │ │ ├── dkms_spec.rb │ │ ├── docker_spec.rb │ │ ├── kde_spec.rb │ │ ├── makepkg_spec.rb │ │ ├── networkmanager_spec.rb │ │ ├── repos │ │ │ ├── jantman_spec.rb │ │ │ └── multilib_spec.rb │ │ ├── sddm_spec.rb │ │ ├── ssh_spec.rb │ │ ├── sudo_spec.rb │ │ └── userapps │ │ │ ├── rvm_spec.rb │ │ │ └── virtualbox_spec.rb │ └── nodesets │ │ └── default.yml ├── classes │ ├── all_spec.rb │ ├── base_packages_spec.rb │ ├── chrony_spec.rb │ ├── coverage_spec.rb │ ├── cronie_spec.rb │ ├── cups_spec.rb │ ├── dkms_spec.rb │ ├── docker_spec.rb │ ├── init_spec.rb │ ├── kde_spec.rb │ ├── makepkg_spec.rb │ ├── networkmanager_spec.rb │ ├── repos │ │ ├── jantman_spec.rb │ │ └── multilib_spec.rb │ ├── sddm_spec.rb │ ├── ssh_spec.rb │ ├── sudo_spec.rb │ ├── template.txt │ ├── userapps │ │ └── virtualbox_spec.rb │ └── xorg_spec.rb ├── defines │ ├── pacman_repo_spec.rb │ └── rvm_spec.rb ├── spec_helper.rb ├── spec_helper_acceptance.rb ├── spec_helper_local.rb └── test_rvm.sh └── templates ├── .gitkeep └── makepkg.conf.erb /.fixtures.yml: -------------------------------------------------------------------------------- 1 | fixtures: 2 | repositories: 3 | stdlib: 4 | repo: "https://github.com/puppetlabs/puppetlabs-stdlib.git" 5 | ref: "4.12.0" 6 | sudo: 7 | repo: "https://github.com/saz/puppet-sudo.git" 8 | ref: "v4.2.0" 9 | ssh: 10 | repo: "https://github.com/saz/puppet-ssh.git" 11 | ref: "v3.0.1" 12 | firewall: 13 | repo: "https://github.com/puppetlabs/puppetlabs-firewall.git" 14 | ref: "1.8.0" 15 | inifile: "https://github.com/puppetlabs/puppetlabs-inifile.git" 16 | staging: "https://github.com/nanliu/puppet-staging.git" 17 | concat: 18 | repo: "https://github.com/puppetlabs/puppetlabs-concat.git" 19 | ref: "2.2.1" 20 | docker: "https://github.com/garethr/garethr-docker.git" 21 | apt: 22 | repo: "https://github.com/puppetlabs/puppetlabs-apt.git" 23 | ref: "2.3.0" 24 | epel: 25 | repo: "https://github.com/stahnma/puppet-module-epel.git" 26 | ref: "1.3.0" 27 | symlinks: 28 | archlinux_workstation: "#{source_dir}" 29 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | #This file is generated by ModuleSync, do not edit. 2 | *.rb eol=lf 3 | *.erb eol=lf 4 | *.pp eol=lf 5 | *.sh eol=lf 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # This file is generated by ModuleSync, do not edit. 2 | *.iml 3 | .*.sw[op] 4 | .DS_Store 5 | .bundle/ 6 | .idea/ 7 | .metadata 8 | .vagrant/ 9 | .yardoc 10 | .yardwarns 11 | Gemfile.local 12 | Gemfile.lock 13 | bin/ 14 | coverage/ 15 | doc/ 16 | junit/ 17 | log/ 18 | pkg/ 19 | spec/fixtures/manifests/ 20 | spec/fixtures/modules/ 21 | tmp/ 22 | vendor/ 23 | 24 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | jantman-archlinux_workstation 4 | 5 | 6 | 7 | 8 | 9 | com.puppetlabs.geppetto.pp.dsl.ui.modulefileBuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.xtext.ui.shared.xtextBuilder 15 | 16 | 17 | 18 | 19 | 20 | com.puppetlabs.geppetto.pp.dsl.ui.puppetNature 21 | org.eclipse.xtext.ui.shared.xtextNature 22 | 23 | 24 | -------------------------------------------------------------------------------- /.rebuildbot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | set +x 4 | . ~/.rvm/scripts/rvm 5 | rvm use $(cat .ruby-version) 6 | rvm info 7 | which ruby 8 | ruby -v 9 | set -x 10 | 11 | bundle install --path vendor 12 | bundle exec rake spec_prep 13 | bundle exec rake beaker 14 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --format documentation 3 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | --- 2 | require: 3 | - rubocop-rspec 4 | AllCops: 5 | TargetRubyVersion: '2.1' 6 | Include: 7 | - "./**/*.rb" 8 | Exclude: 9 | - bin/* 10 | - ".vendor/**/*" 11 | - Gemfile 12 | - Rakefile 13 | - pkg/**/* 14 | - spec/fixtures/**/* 15 | - vendor/**/* 16 | inherit_from: .rubocop_todo.yml 17 | Metrics/LineLength: 18 | Description: People have wide screens, use them. 19 | Max: 200 20 | RSpec/BeforeAfterAll: 21 | Description: Beware of using after(:all) as it may cause state to leak between tests. 22 | A necessary evil in acceptance testing. 23 | Exclude: 24 | - spec/acceptance/**/*.rb 25 | RSpec/HookArgument: 26 | Description: Prefer explicit :each argument, matching existing module's style 27 | EnforcedStyle: each 28 | Style/BlockDelimiters: 29 | Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to 30 | be consistent then. 31 | EnforcedStyle: braces_for_chaining 32 | Style/ClassAndModuleChildren: 33 | Description: Compact style reduces the required amount of indentation. 34 | EnforcedStyle: compact 35 | Style/EmptyElse: 36 | Description: Enforce against empty else clauses, but allow `nil` for clarity. 37 | EnforcedStyle: empty 38 | Style/FormatString: 39 | Description: Following the main puppet project's style, prefer the % format format. 40 | EnforcedStyle: percent 41 | Style/FormatStringToken: 42 | Description: Following the main puppet project's style, prefer the simpler template 43 | tokens over annotated ones. 44 | EnforcedStyle: template 45 | Style/Lambda: 46 | Description: Prefer the keyword for easier discoverability. 47 | EnforcedStyle: literal 48 | Style/RegexpLiteral: 49 | Description: Community preference. See https://github.com/voxpupuli/modulesync_config/issues/168 50 | EnforcedStyle: percent_r 51 | Style/TernaryParentheses: 52 | Description: Checks for use of parentheses around ternary conditions. Enforce parentheses 53 | on complex expressions for better readability, but seriously consider breaking 54 | it up. 55 | EnforcedStyle: require_parentheses_when_complex 56 | Style/TrailingCommaInArguments: 57 | Description: Prefer always trailing comma on multiline argument lists. This makes 58 | diffs, and re-ordering nicer. 59 | EnforcedStyleForMultiline: comma 60 | Style/TrailingCommaInLiteral: 61 | Description: Prefer always trailing comma on multiline literals. This makes diffs, 62 | and re-ordering nicer. 63 | EnforcedStyleForMultiline: comma 64 | Style/SymbolArray: 65 | Description: Using percent style obscures symbolic intent of array's contents. 66 | EnforcedStyle: brackets 67 | Style/CollectionMethods: 68 | Enabled: true 69 | Style/MethodCalledOnDoEndBlock: 70 | Enabled: true 71 | Style/StringMethods: 72 | Enabled: true 73 | Metrics/AbcSize: 74 | Enabled: false 75 | Metrics/BlockLength: 76 | Enabled: false 77 | Metrics/ClassLength: 78 | Enabled: false 79 | Metrics/CyclomaticComplexity: 80 | Enabled: false 81 | Metrics/MethodLength: 82 | Enabled: false 83 | Metrics/ModuleLength: 84 | Enabled: false 85 | Metrics/ParameterLists: 86 | Enabled: false 87 | Metrics/PerceivedComplexity: 88 | Enabled: false 89 | RSpec/DescribeClass: 90 | Enabled: false 91 | RSpec/MessageExpectation: 92 | Enabled: false 93 | Style/AsciiComments: 94 | Enabled: false 95 | Style/IfUnlessModifier: 96 | Enabled: false 97 | Style/SymbolProc: 98 | Enabled: false 99 | -------------------------------------------------------------------------------- /.rubocop_todo.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jantman/puppet-archlinux-workstation/54702178bff3c1a8cbd6030b71459da89b239000/.rubocop_todo.yml -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | ruby-2.2.5 2 | -------------------------------------------------------------------------------- /.sync.yml: -------------------------------------------------------------------------------- 1 | --- 2 | .travis.yml: 3 | # NOTE: these values are repository-specific, created with ` travis encrypt ` 4 | github_token: "A5/0NyMA2TTMEglGEUyDbcATdNTRyu4w4XNXfrlG8Pmg5vSKHM8F1rotUllwAGkhaSia6ZWdY6c0apQNH9FcOvG+Jt66mDjLhhOk5p0uwNuaYyD3GwV61pP2wyMa81XZ9jMhFythfusLgpKUCy+Cpb1cicR0iesO4VZZDMuyxvg=" 5 | puppetforge_password: "VOQbMtzQJjepLvohWA/vxd9yx3VCZfEaQLMTSiVRBR8APHjGXg2YByCI3T70V/oVBXvVuQxvR8fm52TwB+2sCGLB1vWJ/lOGwJZl6R0Q78CO5EJ7ixmxmOVjZD+jscAhxL0hcXy8AoEHLXY2BZFH2OMxL3683HFN/ntUmi0YOQY=" 6 | pushover: 7 | users: 8 | - "XDBBs4rSrvbVSUckhcTSpnqamquz4Qp7J8gEnWppns195U/8bveR7BRUurxomNEB89ZGnoZldUJnc+s0/NFMwa4ssq75ie0Zz2oV9ZgD3MRcImMfu6C5ghtKZvMzKMxzjzXkdHAwmNh/sx854AXu7Jbj8lHpn7gXsnR2JvFfQPU=" 9 | api_key: "VWeNtjcN64AyxadabU9QZTDb73D9d/ZXEOiueSI2SFolXlngot5VHb6T4DC+VxQSkNdjjOcSV99TNjexFNGoe9x2Q2zsg+1PlyvtEy1QLJtMtx55l8YQ5O5//liiuJfFMmnppUoUKVtrbl4YqW1nQyvk602HQoum1t863CdCn+w=" 10 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | #This file is generated by ModuleSync, do not edit. 2 | --- 3 | sudo: false 4 | language: ruby 5 | cache: bundler 6 | script: "bundle exec rake release_checks_nonparallel" 7 | #Inserting below due to the following issue: https://github.com/travis-ci/travis-ci/issues/3531#issuecomment-88311203 8 | before_install: 9 | - gem update bundler 10 | matrix: 11 | fast_finish: true 12 | include: 13 | - rvm: 2.3.1 14 | dist: trusty 15 | env: PUPPET_INSTALL_TYPE=foss BEAKER_debug=true BEAKER_set=default 16 | script: bundle exec rake beaker 17 | services: docker 18 | sudo: required 19 | - rvm: 2.4.1 20 | bundler_args: --without system_tests 21 | env: PUPPET_GEM_VERSION="~> 5.0" 22 | script: ["bundle exec rake release_checks_nonparallel", "bundle exec rake clean", "bundle exec rake build", "bundle exec rake docs"] 23 | - rvm: 2.1.9 24 | bundler_args: --without system_tests 25 | env: PUPPET_GEM_VERSION="~> 4.0" 26 | deploy: 27 | - provider: pages 28 | skip_cleanup: true 29 | github_token: 30 | secure: "A5/0NyMA2TTMEglGEUyDbcATdNTRyu4w4XNXfrlG8Pmg5vSKHM8F1rotUllwAGkhaSia6ZWdY6c0apQNH9FcOvG+Jt66mDjLhhOk5p0uwNuaYyD3GwV61pP2wyMa81XZ9jMhFythfusLgpKUCy+Cpb1cicR0iesO4VZZDMuyxvg=" 31 | local_dir: doc 32 | on: 33 | repo: jantman/puppet-archlinux-workstation 34 | rvm: 2.4.1 35 | # all_branches is required to use tags 36 | all_branches: true 37 | tags: true 38 | - provider: puppetforge 39 | user: jantman 40 | password: 41 | secure: "VOQbMtzQJjepLvohWA/vxd9yx3VCZfEaQLMTSiVRBR8APHjGXg2YByCI3T70V/oVBXvVuQxvR8fm52TwB+2sCGLB1vWJ/lOGwJZl6R0Q78CO5EJ7ixmxmOVjZD+jscAhxL0hcXy8AoEHLXY2BZFH2OMxL3683HFN/ntUmi0YOQY=" 42 | on: 43 | repo: jantman/puppet-archlinux-workstation 44 | rvm: 2.4.1 45 | # all_branches is required to use tags 46 | all_branches: true 47 | tags: true 48 | notifications: 49 | email: 50 | on_success: change 51 | on_failure: change 52 | pushover: 53 | users: 54 | - secure: "XDBBs4rSrvbVSUckhcTSpnqamquz4Qp7J8gEnWppns195U/8bveR7BRUurxomNEB89ZGnoZldUJnc+s0/NFMwa4ssq75ie0Zz2oV9ZgD3MRcImMfu6C5ghtKZvMzKMxzjzXkdHAwmNh/sx854AXu7Jbj8lHpn7gXsnR2JvFfQPU=" 55 | api_key: 56 | secure: "VWeNtjcN64AyxadabU9QZTDb73D9d/ZXEOiueSI2SFolXlngot5VHb6T4DC+VxQSkNdjjOcSV99TNjexFNGoe9x2Q2zsg+1PlyvtEy1QLJtMtx55l8YQ5O5//liiuJfFMmnppUoUKVtrbl4YqW1nQyvk602HQoum1t863CdCn+w=" 57 | branches: 58 | except: 59 | - "/^noci-.*$/" 60 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) 6 | and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). 7 | 8 | [comment]: # IMPORTANT: Remember to update the links at the bottom of the file! 9 | 10 | ## [0.5.1] Released 2020-09-24 11 | 12 | - Update for ``bind-tools`` Arch package removed, rolled into ``bind`` package 13 | 14 | ## [0.5.0] Released 2020-04-14 15 | 16 | - ``sshd_config`` - Remove deprecated ``RSAAuthentication`` and ``UsePrivilegeSeparation`` options 17 | 18 | ## [0.4.0] Released 2019-03-19 19 | 20 | - Pin some dependencies in ``.fixtures.yml`` to fix tests 21 | - Switch acceptance tests from deprecated ``archimg/base-devel:latest`` Docker image to ``archlinux/base:latest`` 22 | - Fix Puppet4 unit tests by pinning ``puppet-module-posix-dev-r2.1`` version to 0.3.2 23 | - ``kde`` class - stop managing ``phonon-qt4`` packages as they've been removed from the repos 24 | - Add ``.sync.yml`` for my [modulesync_configs](https://github.com/jantman/modulesync_configs) 25 | - Update ``.travis.yml``, ``Gemfile`` and some documentation via modulesync. 26 | - Fix ``metadata.json`` casing of supported operatingsystem name. 27 | 28 | ## [0.3.2] Released 2017-12-28 29 | 30 | - Add automated ``github_release`` Rake task. 31 | - Bump puppet-blacksmith gem version and configure for signed tags. 32 | - Reformat changelog 33 | 34 | ## [0.3.1] Released 2017-12-28 35 | 36 | - Minor README and CONTRIBUTING documentation updates. 37 | 38 | ## [0.3.0] Released 2017-12-28 39 | 40 | - Switch to new-style typed parameters. 41 | - Modernize module layout and testing. 42 | - Update supported and tested Puppet versions to 4 and 5. 43 | - Many major puppet module dependency updates. 44 | - Pin puppetlabs-stdlib dependency to 4.12.0, as unfortunately saz/sudo still uses the deprecated ``validate_`` functions. 45 | - Add ``service_state`` parameter to docker class, mainly for acceptance testing 46 | - Add ``service_ensure`` parameter to ``sddm`` class, mainly for acceptance testing 47 | - Use puppet-strings for documentation 48 | - Automate deployment through TravisCI 49 | 50 | ## [0.2.1] Released 2017-07-17 51 | 52 | - Handle upstream chrony service rename to chronyd 53 | 54 | ## [0.2.0] Released 2017-07-09 55 | 56 | - Bump saz/sudo requirement to 4.2.0+ for Arch Linux bug fix 57 | - Remove "xorg-server-utils" package, which has been removed from repos. 58 | 59 | ## [0.1.5] Released 2016-12-05 60 | 61 | - add management of /etc/conf.d to archlinux_workstation::docker class, as it may not already exist 62 | 63 | ## 0.1.3 Released 2016-09-01 64 | 65 | - remove virtualbox-host-modules package in favor of virtualbox-host-dkms 66 | - remove dkms service, as module rebuilding is now handled at install-time via alpm hooks 67 | 68 | ## 0.1.2 Released 2016-03-10 69 | 70 | - add support for PACKAGER variable in makepkg.conf (via ``archlinux_workstation`` class variable) 71 | 72 | ## 0.1.1 Released 2015-11-25 73 | 74 | - add support for a '-m' mail command for cronie 75 | 76 | ## 0.1.0 Released 2015-09-16 77 | 78 | - major ground-up rewrite of module to be more reusable, and targeted at puppet4 79 | 80 | ## 0.0.1 Released 2014-03-15 81 | 82 | - initial module creation 83 | - migration of a bunch of stuff from https://github.com/jantman/puppet-archlinux-macbookretina 84 | 85 | [0.5.0]: https://github.com/jantman/puppet-archlinux-workstation/compare/0.4.0...0.5.0 86 | [0.4.0]: https://github.com/jantman/puppet-archlinux-workstation/compare/0.3.2...0.4.0 87 | [0.3.2]: https://github.com/jantman/puppet-archlinux-workstation/compare/0.3.1...0.3.2 88 | [0.3.1]: https://github.com/jantman/puppet-archlinux-workstation/compare/0.3.0...0.3.1 89 | [0.3.0]: https://github.com/jantman/puppet-archlinux-workstation/compare/0.2.1...0.3.0 90 | [0.2.1]: https://github.com/jantman/puppet-archlinux-workstation/compare/0.2.0...0.2.1 91 | [0.2.0]: https://github.com/jantman/puppet-archlinux-workstation/compare/0.1.5...0.2.0 92 | [0.1.5]: https://github.com/jantman/puppet-archlinux-workstation/compare/0.1.3...0.1.5 93 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Puppet modules 2 | 3 | So you want to contribute to a Puppet module: Great! Below are some instructions to get you started doing 4 | that very thing while setting expectations around code quality as well as a few tips for making the 5 | process as easy as possible. 6 | 7 | ### Table of Contents 8 | 9 | 1. [Getting Started](#getting-started) 10 | 1. [Commit Checklist](#commit-checklist) 11 | 1. [Submission](#submission) 12 | 1. [More about commits](#more-about-commits) 13 | 1. [Testing](#testing) 14 | - [Running Tests](#running-tests) 15 | - [Writing Tests](#writing-tests) 16 | 1. [Get Help](#get-help) 17 | 1. [Release Process](#release-process) 18 | 19 | ## Getting Started 20 | 21 | - Fork the module repository on GitHub and clone to your workspace 22 | 23 | - Make your changes! 24 | 25 | ## Commit Checklist 26 | 27 | ### The Basics 28 | 29 | - [x] my commit is a single logical unit of work 30 | 31 | - [x] I have checked for unnecessary whitespace with "git diff --check" 32 | 33 | - [x] my commit does not include commented out code or unneeded files 34 | 35 | ### The Content 36 | 37 | - [x] my commit includes tests for the bug I fixed or feature I added 38 | 39 | - [x] my commit includes appropriate documentation changes if it is introducing a new feature or changing existing functionality 40 | 41 | - [x] my code passes existing test suites 42 | 43 | ### The Commit Message 44 | 45 | - [x] the first line of my commit message includes: 46 | 47 | - [x] an issue number (if applicable), e.g. "(MODULES-xxxx) This is the first line" 48 | 49 | - [x] a short description (50 characters is the soft limit, excluding ticket number(s)) 50 | 51 | - [x] the body of my commit message: 52 | 53 | - [x] is meaningful 54 | 55 | - [x] uses the imperative, present tense: "change", not "changed" or "changes" 56 | 57 | - [x] includes motivation for the change, and contrasts its implementation with the previous behavior 58 | 59 | ## Submission 60 | 61 | ### Push and PR 62 | 63 | - Push your changes to your fork 64 | 65 | - [Open a Pull Request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) against the repository in the puppetlabs organization 66 | 67 | ## More about commits 68 | 69 | 1. Make separate commits for logically separate changes. 70 | 71 | Please break your commits down into logically consistent units 72 | which include new or changed tests relevant to the rest of the 73 | change. The goal of doing this is to make the diff easier to 74 | read for whoever is reviewing your code. In general, the easier 75 | your diff is to read, the more likely someone will be happy to 76 | review it and get it into the code base. 77 | 78 | If you are going to refactor a piece of code, please do so as a 79 | separate commit from your feature or bug fix changes. 80 | 81 | We also really appreciate changes that include tests to make 82 | sure the bug is not re-introduced, and that the feature is not 83 | accidentally broken. 84 | 85 | Describe the technical detail of the change(s). If your 86 | description starts to get too long, that is a good sign that you 87 | probably need to split up your commit into more finely grained 88 | pieces. 89 | 90 | Commits which plainly describe the things which help 91 | reviewers check the patch and future developers understand the 92 | code are much more likely to be merged in with a minimum of 93 | bike-shedding or requested changes. Ideally, the commit message 94 | would include information, and be in a form suitable for 95 | inclusion in the release notes for the version of Puppet that 96 | includes them. 97 | 98 | Please also check that you are not introducing any trailing 99 | whitespace or other "whitespace errors". You can do this by 100 | running "git diff --check" on your changes before you commit. 101 | 102 | 2. Sending your patches 103 | 104 | To submit your changes via a GitHub pull request, we _highly_ 105 | recommend that you have them on a topic branch, instead of 106 | directly on "master". 107 | It makes things much easier to keep track of, especially if 108 | you decide to work on another thing before your first change 109 | is merged in. 110 | 111 | GitHub has some pretty good 112 | [general documentation](http://help.github.com/) on using 113 | their site. They also have documentation on 114 | [creating pull requests](https://help.github.com/articles/creating-a-pull-request-from-a-fork/). 115 | 116 | In general, after pushing your topic branch up to your 117 | repository on GitHub, you can switch to the branch in the 118 | GitHub UI and click "Pull Request" towards the top of the page 119 | in order to open a pull request. 120 | 121 | 3. Update the related JIRA issue. 122 | 123 | If there is a JIRA issue associated with the change you 124 | submitted, then you should update the ticket to include the 125 | location of your branch, along with any other commentary you 126 | may wish to make. 127 | 128 | # Testing 129 | 130 | ## Getting Started 131 | 132 | Our Puppet modules provide [`Gemfile`](./Gemfile)s, which can tell a Ruby package manager such as [bundler](http://bundler.io/) what Ruby packages, 133 | or Gems, are required to build, develop, and test this software. 134 | 135 | Please make sure you have [bundler installed](http://bundler.io/#getting-started) on your system, and then use it to 136 | install all dependencies needed for this project in the project root by running 137 | 138 | ```shell 139 | % bundle install --path .bundle/gems 140 | Fetching gem metadata from https://rubygems.org/........ 141 | Fetching gem metadata from https://rubygems.org/.. 142 | Using rake (10.1.0) 143 | Using builder (3.2.2) 144 | -- 8><-- many more --><8 -- 145 | Using rspec-system-puppet (2.2.0) 146 | Using serverspec (0.6.3) 147 | Using rspec-system-serverspec (1.0.0) 148 | Using bundler (1.3.5) 149 | Your bundle is complete! 150 | Use `bundle show [gemname]` to see where a bundled gem is installed. 151 | ``` 152 | 153 | NOTE: some systems may require you to run this command with sudo. 154 | 155 | If you already have those gems installed, make sure they are up-to-date: 156 | 157 | ```shell 158 | % bundle update 159 | ``` 160 | 161 | ## Running Tests 162 | 163 | With all dependencies in place and up-to-date, run the tests: 164 | 165 | ### Unit Tests 166 | 167 | ```shell 168 | % bundle exec rake spec 169 | ``` 170 | 171 | This executes all the [rspec tests](http://rspec-puppet.com/) in the directories defined [here](https://github.com/puppetlabs/puppetlabs_spec_helper/blob/699d9fbca1d2489bff1736bb254bb7b7edb32c74/lib/puppetlabs_spec_helper/rake_tasks.rb#L17) and so on. 172 | rspec tests may have the same kind of dependencies as the module they are testing. Although the module defines these dependencies in its [metadata.json](./metadata.json), 173 | rspec tests define them in [.fixtures.yml](./fixtures.yml). 174 | 175 | Before submitting a pull request, you should run the full pre-release check Rake task: 176 | 177 | ```shell 178 | % bundle exec rake release_checks 179 | ``` 180 | 181 | ### Acceptance Tests 182 | 183 | Some Puppet modules also come with acceptance tests, which use [beaker][]. These tests spin up a virtual machine under 184 | [VirtualBox](https://www.virtualbox.org/), controlled with [Vagrant](http://www.vagrantup.com/), to simulate scripted test 185 | scenarios. In order to run these, you need both Virtualbox and Vagrant installed on your system. 186 | 187 | Run the tests by issuing the following command 188 | 189 | ```shell 190 | % bundle exec rake spec_clean 191 | % bundle exec rake beaker 192 | ``` 193 | 194 | This will now download a pre-fabricated image configured in the [default node-set](./spec/acceptance/nodesets/default.yml), 195 | install Puppet, copy this module, and install its dependencies per [spec/spec_helper_acceptance.rb](./spec/spec_helper_acceptance.rb) 196 | and then run all the tests under [spec/acceptance](./spec/acceptance). 197 | 198 | ## Writing Tests 199 | 200 | ### Unit Tests 201 | 202 | When writing unit tests for Puppet, [rspec-puppet][] is your best friend. It provides tons of helper methods for testing your manifests against a 203 | catalog (e.g. contain_file, contain_package, with_params, etc). It would be ridiculous to try and top rspec-puppet's [documentation][rspec-puppet_docs] 204 | but here's a tiny sample: 205 | 206 | Sample manifest: 207 | 208 | ```puppet 209 | file { "a test file": 210 | ensure => present, 211 | path => "/etc/sample", 212 | } 213 | ``` 214 | 215 | Sample test: 216 | 217 | ```ruby 218 | it 'does a thing' do 219 | expect(subject).to contain_file("a test file").with({:path => "/etc/sample"}) 220 | end 221 | ``` 222 | 223 | ### Acceptance Tests 224 | 225 | Writing acceptance tests for Puppet involves [beaker][] and its cousin [beaker-rspec][]. A common pattern for acceptance tests is to create a test manifest, apply it 226 | twice to check for idempotency or errors, then run expectations. 227 | 228 | ```ruby 229 | it 'does an end-to-end thing' do 230 | pp = <<-EOF 231 | file { 'a test file': 232 | ensure => present, 233 | path => "/etc/sample", 234 | content => "test string", 235 | } 236 | EOF 237 | 238 | apply_manifest(pp, :catch_failures => true) 239 | apply_manifest(pp, :catch_changes => true) 240 | 241 | end 242 | 243 | describe file("/etc/sample") do 244 | it { is_expected.to contain "test string" } 245 | end 246 | 247 | ``` 248 | 249 | ### If you have commit access to the repository 250 | 251 | Even if you have commit access to the repository, you still need to go through the process above, and have someone else review and merge 252 | in your changes. The rule is that **all changes must be reviewed by a project developer that did not write the code to ensure that 253 | all changes go through a code review process.** 254 | 255 | The record of someone performing the merge is the record that they performed the code review. Again, this should be someone other than the author of the topic branch. 256 | 257 | # Get Help 258 | 259 | ### On the web 260 | 261 | * [Puppet help messageboard](http://puppet.com/community/get-help) 262 | * [Writing tests](https://docs.puppet.com/guides/module_guides/bgtm.html#step-three-module-testing) 263 | * [General GitHub documentation](http://help.github.com/) 264 | * [GitHub pull request documentation](http://help.github.com/send-pull-requests/) 265 | 266 | # Release Process 267 | 268 | 1. Ensure all changes were merged to master via PRs. 269 | 2. Ensure a [CHANGELOG.md](CHANGELOG.md) entry exists for every change. 270 | 3. Use ``bundle exec rake module:bump`` to bump the module version. 271 | 4. Update ``CHANGELOG.md`` with the new version, and ensure a link exists for the diff from the last release. 272 | 5. Commit those changes (``CHANGELOG.md`` and ``metadata.json``) and push. Wait for the TravisCI build to pass. 273 | 6. Use ``bundle exec rake github_release`` to tag the version, push that tag, and create a GitHub Release. 274 | 7. TravisCI will build the module and push to the forge, and build docs and push them to github pages. 275 | 276 | [rspec-puppet]: http://rspec-puppet.com/ 277 | [rspec-puppet_docs]: http://rspec-puppet.com/documentation/ 278 | [beaker]: https://github.com/puppetlabs/beaker 279 | [beaker-rspec]: https://github.com/puppetlabs/beaker-rspec 280 | -------------------------------------------------------------------------------- /CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | jantman 2 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | #This file is generated by ModuleSync, do not edit. 2 | 3 | source ENV['GEM_SOURCE'] || "https://rubygems.org" 4 | 5 | # Determines what type of gem is requested based on place_or_version. 6 | def gem_type(place_or_version) 7 | if place_or_version =~ /^git:/ 8 | :git 9 | elsif place_or_version =~ /^file:/ 10 | :file 11 | else 12 | :gem 13 | end 14 | end 15 | 16 | # Find a location or specific version for a gem. place_or_version can be a 17 | # version, which is most often used. It can also be git, which is specified as 18 | # `git://somewhere.git#branch`. You can also use a file source location, which 19 | # is specified as `file://some/location/on/disk`. 20 | def location_for(place_or_version, fake_version = nil) 21 | if place_or_version =~ /^(git[:@][^#]*)#(.*)/ 22 | [fake_version, { :git => $1, :branch => $2, :require => false }].compact 23 | elsif place_or_version =~ /^file:\/\/(.*)/ 24 | ['>= 0', { :path => File.expand_path($1), :require => false }] 25 | else 26 | [place_or_version, { :require => false }] 27 | end 28 | end 29 | 30 | # Used for gem conditionals 31 | ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments 32 | minor_version = "#{ruby_version_segments[0]}.#{ruby_version_segments[1]}" 33 | 34 | # The following gems are not included by default as they require DevKit on Windows. 35 | # You should probably include them in a Gemfile.local or a ~/.gemfile 36 | #gem 'pry' #this may already be included in the gemfile 37 | #gem 'pry-stack_explorer', :require => false 38 | #if RUBY_VERSION =~ /^2/ 39 | # gem 'pry-byebug' 40 | #else 41 | # gem 'pry-debugger' 42 | #end 43 | 44 | group :development do 45 | gem "puppet-module-posix-default-r#{minor_version}", :require => false, :platforms => "ruby" 46 | gem "puppet-module-win-default-r#{minor_version}", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"] 47 | if minor_version == '2.1' 48 | gem "puppet-module-posix-dev-r2.1", '0.3.2', :require => false, :platforms => "ruby" 49 | else 50 | gem "puppet-module-posix-dev-r#{minor_version}", :require => false, :platforms => "ruby" 51 | end 52 | gem "puppet-module-win-dev-r#{minor_version}", '0.0.7', :require => false, :platforms => ["mswin", "mingw", "x64_mingw"] 53 | gem "json_pure", '<= 2.0.1', :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0') 54 | gem "fast_gettext", '1.1.0', :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0') 55 | gem "fast_gettext", :require => false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0') 56 | gem "puppet-strings", :require => false 57 | end 58 | 59 | group :system_tests do 60 | gem "beaker-docker", '>= 0.3.0', :require => false 61 | gem "puppet-module-posix-system-r#{minor_version}", :require => false, :platforms => "ruby" 62 | gem "puppet-module-win-system-r#{minor_version}", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"] 63 | gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '>= 3') 64 | gem "beaker-pe", :require => false 65 | gem "beaker-rspec", *location_for(ENV['BEAKER_RSPEC_VERSION']) 66 | gem "beaker-hostgenerator", *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION']) 67 | gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1') 68 | gem "puppet-blacksmith", '>= 4.1.1', :require => false 69 | gem "vandamme", :require => false 70 | gem "octokit", '~> 4.0', :require => false 71 | end 72 | 73 | gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION']) 74 | 75 | # Only explicitly specify Facter/Hiera if a version has been specified. 76 | # Otherwise it can lead to strange bundler behavior. If you are seeing weird 77 | # gem resolution behavior, try setting `DEBUG_RESOLVER` environment variable 78 | # to `1` and then run bundle install. 79 | gem 'facter', *location_for(ENV['FACTER_GEM_VERSION']) if ENV['FACTER_GEM_VERSION'] 80 | gem 'hiera', *location_for(ENV['HIERA_GEM_VERSION']) if ENV['HIERA_GEM_VERSION'] 81 | 82 | # Evaluate Gemfile.local if it exists 83 | if File.exists? "#{__FILE__}.local" 84 | eval(File.read("#{__FILE__}.local"), binding) 85 | end 86 | 87 | # Evaluate ~/.gemfile if it exists 88 | if File.exists?(File.join(Dir.home, '.gemfile')) 89 | eval(File.read(File.join(Dir.home, '.gemfile')), binding) 90 | end 91 | 92 | # vim:ft=ruby 93 | -------------------------------------------------------------------------------- /Guardfile: -------------------------------------------------------------------------------- 1 | notification :off 2 | 3 | guard 'rake', :task => 'test' do 4 | watch(%r{^manifests\/(.+)\.pp$}) 5 | end 6 | -------------------------------------------------------------------------------- /MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | ## Maintenance 2 | 3 | Maintainers: 4 | - Jason Antman `jason |at| jasonantman |dot| com` 5 | 6 | Tickets: https://github.com/jantman/puppet-archlinux-workstation/issues 7 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Puppet Module - jantman-archlinux_workstation 2 | 3 | Copyright 2018 Jason Antman 4 | 5 | Licensed under the GNU GPL v3; 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | https://www.gnu.org/licenses/gpl-3.0.en.html 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | ## DEPRECATED - DO NOT USE 2 | 3 | As of December 2022, this project is deprecated. It's sufficiently different from how I want to manage my new machines that it's not worth keeping up to date, and therefore I'm abandoning it. 4 | 5 | #### Table of Contents 6 | 7 | 1. [Overview](#overview) 8 | 2. [Module Description - What the module does and why it is useful](#module-description) 9 | 3. [Setup - The basics of getting started with archlinux_workstation](#setup) 10 | * [What archlinux_workstation affects](#what-archlinux_workstation-affects) 11 | 4. [Requirements](#requirements) 12 | 5. [Usage - Configuration options and additional functionality](#usage) 13 | 6. [Reference - An under-the-hood peek at what the module is doing and how](#reference) 14 | 7. [Limitations - OS compatibility, etc.](#limitations) 15 | 8. [Development - Guide for contributing to the module](#development) 16 | * [Adding Classes](#adding-classes) 17 | 18 | ## Overview 19 | 20 | [![PuppetForge version badge](https://img.shields.io/puppetforge/v/jantman/archlinux_workstation.svg)](https://forge.puppet.com/jantman/archlinux_workstation/) 21 | [![Project Status: Unsupported – The project has reached a stable, usable state but the author(s) have ceased all work on it. A new maintainer may be desired.](https://www.repostatus.org/badges/latest/unsupported.svg)](https://www.repostatus.org/#unsupported) 22 | 23 | Provides many classes for configuring an Arch Linux workstation/laptop/desktop for graphical use and installing common software. 24 | 25 | * Generated Documentation: http://jantman.github.io/puppet-archlinux-workstation/ 26 | 27 | ## Module Description 28 | 29 | This is one of the modules that I use to keep my personal desktop and work laptop, both running Arch Linux, in sync, up to date, 30 | and easily rebuild-able. It's intended to do three main things: 31 | 32 | 1. Manage all installed packages, and all configuration outside of ``/home``, so I don't need to back up anything outside ``/home``. 33 | 2. Keep my desktop and laptop perfectly in sync in terms of packages and global (non-user-specific) configuration. 34 | 3. Allow me to quickly rebuild one of these machines if needed, to minimize downtime. 35 | 36 | This module is intended to be part of a whole. For me, that includes my workstation-bootstrap module ([GitHub](https://github.com/jantman/workstation-bootstrap)) 37 | that uses [r10k](https://github.com/adrienthebo/r10k), a Puppetfile, and a few manifests to actually manage what's applied to my machines and install modules, 38 | as well as a private module ("privatepuppet") on GitHub for my sensitive/personal configuration, and a specific module for Arch Linux on my 39 | [MacBook Pro Retina](https://github.com/jantman/puppet-archlinux-macbookretina) that handles some things specific to that platform. 40 | 41 | __Note:__ this module is quite opinionated; it is how _I_ setup _my_ machines, and may not be exactly what you want. Pull requests are 42 | welcome to add parameters for more control over its behavior. 43 | 44 | ## Setup 45 | 46 | ### What archlinux_workstation affects 47 | 48 | See the [Reference](#reference) section below for details. In general, the goal is that it affects anything and everything you'd 49 | need to touch to take a base Arch Linux installation to a fully-usable, graphical workstation/laptop/desktop. 50 | This includes: 51 | 52 | * your login user, a primary group with the same name as the username, and their supplementary groups 53 | 54 | Optionally: 55 | 56 | * sudoers file and sudoers.d entries for your user 57 | * sshd_config, including AllowUsers (your user only) and auth methods (pubkey/RSA only) 58 | * ``/etc/makepkg.conf``, set to compile and cache sources under ``/tmp`` (tmpfs), and specify -j${::processorcount} make flag. 59 | * installation of some common base packages (see ``archlinux_workstation::base_packages`` below) 60 | * use of the [puppetlabs/firewall](http://forge.puppetlabs.com/puppetlabs/firewall) module to manage iptables (note that 61 | it's expected you setup the module elsewhere, as I do in [workstation_bootstrap](https://github.com/jantman/workstation-bootstrap) - 62 | this module just adds rules for its services using the Firewall type). 63 | * enable dkms support by installing the dkms package 64 | * sets up [CUPS](https://wiki.archlinux.org/index.php/Cups) printing 65 | * sets up the [Chrony](https://wiki.archlinux.org/index.php/Chrony) alternative NTP daemon 66 | * installs [Xorg](https://wiki.archlinux.org/index.php/Xorg) Xserver as well as related required and recommended/optional packages 67 | (note - this currently only installs the default vesa driver. See archlinux_workstation::xorg below for more information) 68 | * if the ``gui`` parameter is set to 'kde' (default), installs [KDE Plasma](https://wiki.archlinux.org/index.php/KDE) 69 | and installs and runs [SDDM](https://wiki.archlinux.org/index.php/SDDM) 70 | * sets up my [personal (jantman) pacman repo](http://archrepo.jasonantman.com/) and the [Multilib](https://wiki.archlinux.org/index.php/Multilib) repo 71 | * installation of a number of different user applications (see ``archlinux_workstation::userapps::`` classes below) 72 | 73 | ## Usage 74 | 75 | Classes are parameterized where that makes sense. Right now, there are two methods of usage: 76 | 77 | 1. To install and setup _everything_ this module is capable of, declare an instance of ``archlinux_workstation`` passing the ``username`` parameter for the name of your user, and an instance of ``archlinux_workstation::all`` to do _everything_. 78 | 79 | ```puppet 80 | class {'archlinux_workstation': 81 | username => 'myname', 82 | } 83 | 84 | class {'archlinux_workstation::all': } 85 | ``` 86 | 87 | 2. To pick and choose which parts you use, declare ``archlinux_workstation`` as shown above, and in place of ``archlinux_workstation::all``, declare the classes that you want. 88 | 89 | If you stick to one of these two usage methods (instead of forking this module and hacking on the internals), you should be safe to pull in updates as they happen. 90 | 91 | ## Reference 92 | 93 | For full automatically-generated documentation see: [http://jantman.github.io/puppet-archlinux-workstation/](http://jantman.github.io/puppet-archlinux-workstation/) 94 | 95 | ## Limitations 96 | 97 | This module is only usable with Arch Linux. 98 | 99 | It assumes that you have a relatively vanilla base install of Arch, such as the one I document in my [workstation-bootstrap module](https://github.com/jantman/workstation-bootstrap#arch-linux), 100 | pretty much the same as the [Arch Linux Installation Guide](https://wiki.archlinux.org/index.php/Installation_guide) documents. 101 | 102 | ## Development 103 | 104 | See [CONTRIBUTING.md](CONTRIBUTING.md) for information about development and contributing. 105 | 106 | ### Adding Classes 107 | 108 | To add a class: 109 | 110 | 1. Add the class itself, using the template: ``sed 's/CLASSNAME/name_of_class/g' manifests/template.txt > manifests/name_of_class.pp`` 111 | 2. Add spec tests, using the template: ``sed 's/CLASSNAME/name_of_class/g' spec/classes/template.txt > spec/classes/name_of_class.pp`` 112 | 3. Add acceptance tests. 113 | 4. Add the class to the [Reference](#reference) section above 114 | 5. Add the class to the ``archlinux_workstation::all`` (``manifests/all.pp``) class. 115 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'puppetlabs_spec_helper/rake_tasks' 2 | require 'puppet-lint/tasks/puppet-lint' 3 | require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any? 4 | require 'puppet-strings' if Bundler.rubygems.find_name('puppet-strings').any? 5 | require 'vandamme' if Bundler.rubygems.find_name('vandamme').any? 6 | require 'octokit' if Bundler.rubygems.find_name('octokit').any? 7 | require 'json' 8 | 9 | PuppetLint.configuration.fail_on_warnings = true 10 | PuppetLint.configuration.send('relative') 11 | 12 | desc 'Generate pooler nodesets' 13 | task :gen_nodeset do 14 | require 'beaker-hostgenerator' 15 | require 'securerandom' 16 | require 'fileutils' 17 | 18 | agent_target = ENV['TEST_TARGET'] 19 | if ! agent_target 20 | STDERR.puts 'TEST_TARGET environment variable is not set' 21 | STDERR.puts 'setting to default value of "redhat-64default."' 22 | agent_target = 'redhat-64default.' 23 | end 24 | 25 | master_target = ENV['MASTER_TEST_TARGET'] 26 | if ! master_target 27 | STDERR.puts 'MASTER_TEST_TARGET environment variable is not set' 28 | STDERR.puts 'setting to default value of "redhat7-64mdcl"' 29 | master_target = 'redhat7-64mdcl' 30 | end 31 | 32 | targets = "#{master_target}-#{agent_target}" 33 | cli = BeakerHostGenerator::CLI.new([targets]) 34 | nodeset_dir = "tmp/nodesets" 35 | nodeset = "#{nodeset_dir}/#{targets}-#{SecureRandom.uuid}.yaml" 36 | FileUtils.mkdir_p(nodeset_dir) 37 | File.open(nodeset, 'w') do |fh| 38 | fh.print(cli.execute) 39 | end 40 | puts nodeset 41 | end 42 | 43 | desc "NON-PARALLEL version of release_checks" 44 | task :release_checks_nonparallel do 45 | Rake::Task[:lint].invoke 46 | Rake::Task[:validate].invoke 47 | Rake::Task[:spec].invoke 48 | Rake::Task["check:symlinks"].invoke 49 | Rake::Task["check:test_file"].invoke 50 | Rake::Task["check:dot_underscore"].invoke 51 | Rake::Task["check:git_ignore"].invoke 52 | end 53 | 54 | if Bundler.rubygems.find_name('puppet-blacksmith').any? && Bundler.rubygems.find_name('vandamme').any? 55 | bsmith = Blacksmith::RakeTask.new do |t| 56 | t.tag_message_pattern = "Version %s" # Signed tags must have a message 57 | t.tag_sign = true # enable GPG signing 58 | end 59 | 60 | desc 'Tag git (signed), push tag, interactively verify changelog, create GitHub Release' 61 | task :github_release do 62 | fail('ERROR: you must export GITHUB_TOKEN env var') unless ENV.include?('GITHUB_TOKEN') 63 | client = Octokit::Client.new(access_token: ENV['GITHUB_TOKEN']) 64 | # ensure we have valid auth 65 | client.user 66 | # get the module version 67 | mod = Blacksmith::Modulefile.new 68 | modver = mod.version 69 | modtag = "v#{modver}" 70 | # make sure we don't already have a release for it 71 | client.releases('jantman/puppet-archlinux-workstation').each do |r| 72 | abort("ERROR: GitHub Release already exists for tag #{modtag}") if modtag == r.tag_name 73 | end 74 | puts "Module version: #{modver}" 75 | chglog = Vandamme::Parser.new( 76 | changelog: File.read('CHANGELOG.md'), 77 | version_header_exp: /## \[(\d+\.\d+\.\d+)\] Released (\d{4}-\d{2}-\d{2})/, 78 | format: 'markdown' 79 | ).parse 80 | fail("ERROR: no CHANGELOG.md entry for version #{modver}") unless chglog.has_key?(modver) 81 | puts "Changelog for #{modver}:\n\n#{chglog[modver]}\n\n" 82 | print "Does this look correct? [y|N] " 83 | abort('Aborted! Exiting.') unless STDIN.gets.strip == 'y' 84 | puts "Tagging..." 85 | Rake::Task["module:tag"].invoke 86 | puts "Pushing git with tags..." 87 | bsmith.git.push! 88 | puts "Creating GitHub Release..." 89 | rel = client.create_release( 90 | 'jantman/puppet-archlinux-workstation', 91 | modtag, 92 | name: modver, 93 | body: chglog[modver] 94 | ) 95 | puts "Created release: #{rel.html_url}" 96 | end 97 | end 98 | 99 | if Bundler.rubygems.find_name('puppet-strings').any? 100 | # Reimplement puppet-strings "strings:generate" task with custom params 101 | desc 'Generate Puppet documentation with YARD.' 102 | task :docs do 103 | patterns = PuppetStrings::DEFAULT_SEARCH_PATTERNS 104 | 105 | meta = JSON.parse(File.read('metadata.json')) 106 | options = { 107 | debug: false, 108 | backtrace: true, 109 | markup: 'markdown', 110 | yard_args: ['--title', "Puppet module jantman/archlinux_workstation #{meta['version']}"], 111 | } 112 | 113 | PuppetStrings.generate(patterns, options) 114 | end 115 | end 116 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 1.1.x.{build} 2 | skip_commits: 3 | message: /^\(?doc\)?.*/ 4 | clone_depth: 10 5 | init: 6 | - SET 7 | - 'mkdir C:\ProgramData\PuppetLabs\code && exit 0' 8 | - 'mkdir C:\ProgramData\PuppetLabs\facter && exit 0' 9 | - 'mkdir C:\ProgramData\PuppetLabs\hiera && exit 0' 10 | - 'mkdir C:\ProgramData\PuppetLabs\puppet\var && exit 0' 11 | environment: 12 | matrix: 13 | - PUPPET_GEM_VERSION: ~> 4.0 14 | RUBY_VER: 21 15 | - PUPPET_GEM_VERSION: ~> 4.0 16 | RUBY_VER: 21-x64 17 | - PUPPET_GEM_VERSION: ~> 5.0 18 | RUBY_VER: 24 19 | - PUPPET_GEM_VERSION: ~> 5.0 20 | RUBY_VER: 24-x64 21 | - PUPPET_GEM_VERSION: 4.7.1 22 | RUBY_VER: 21-x64 23 | matrix: 24 | fast_finish: true 25 | install: 26 | - SET PATH=C:\Ruby%RUBY_VER%\bin;%PATH% 27 | - ps: | 28 | gem list openssl 29 | ruby -ropenssl -e 'puts \"OpenSSL Version - #{OpenSSL::OPENSSL_VERSION}\"; puts \"OpenSSL Library Version - #{OpenSSL::OPENSSL_LIBRARY_VERSION}\"' 30 | - bundle install --jobs 4 --retry 2 --without system_tests 31 | - type Gemfile.lock 32 | build: off 33 | test_script: 34 | - bundle exec puppet -V 35 | - ruby -v 36 | - bundle exec rake spec SPEC_OPTS='--format documentation' 37 | notifications: 38 | - provider: Email 39 | to: 40 | - nobody@nowhere.com 41 | on_build_success: false 42 | on_build_failure: false 43 | on_build_status_changed: false 44 | -------------------------------------------------------------------------------- /files/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jantman/puppet-archlinux-workstation/54702178bff3c1a8cbd6030b71459da89b239000/files/.gitkeep -------------------------------------------------------------------------------- /files/chrony.conf: -------------------------------------------------------------------------------- 1 | ############################################################## 2 | # WARNING - WARNING - WARNING 3 | # This file is managed by the puppet-archlinux-macbookretina 4 | # puppet module. Any local changes made here will be 5 | # overwritten on the next Puppet run. Please change the 6 | # file in the puppet module for persistent changes. 7 | ############################################################## 8 | 9 | ####################################################################### 10 | # 11 | # This is an example chrony configuration file. You should copy it to 12 | # /etc/chrony.conf after uncommenting and editing the options that you 13 | # want to enable. The more obscure options are not included. Refer 14 | # to the documentation for these. 15 | # 16 | # Copyright 2002 Richard P. Curnow 17 | # 18 | # This program is free software; you can redistribute it and/or modify 19 | # it under the terms of version 2 of the GNU General Public License as 20 | # published by the Free Software Foundation. 21 | # 22 | # This program is distributed in the hope that it will be useful, but 23 | # WITHOUT ANY WARRANTY; without even the implied warranty of 24 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 25 | # General Public License for more details. 26 | # 27 | # You should have received a copy of the GNU General Public License along 28 | # with this program; if not, write to the Free Software Foundation, Inc., 29 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 30 | # 31 | # 32 | ####################################################################### 33 | ### COMMENTS 34 | # Any of the following lines are comments (you have a choice of 35 | # comment start character): 36 | # a comment 37 | % a comment 38 | ! a comment 39 | ; a comment 40 | # 41 | # Below, the '!' form is used for lines that you might want to 42 | # uncomment and edit to make your own chrony.conf file. 43 | # 44 | ####################################################################### 45 | ####################################################################### 46 | ### SPECIFY YOUR NTP SERVERS 47 | # Most computers using chrony will send measurement requests to one or 48 | # more 'NTP servers'. You will probably find that your Internet Service 49 | # Provider or company have one or more NTP servers that you can specify. 50 | # Failing that, there are a lot of public NTP servers. There is a list 51 | # you can access at 52 | # http://www.eecis.udel.edu/~mills/ntp/servers.htm. 53 | 54 | server 0.pool.ntp.org iburst 55 | server 1.pool.ntp.org iburst 56 | server 2.pool.ntp.org iburst 57 | 58 | # However, for dial-up use you probably want these instead. The word 59 | # 'offline' means that the server is not visible at boot time. Use 60 | # chronyc's 'online' command to tell chronyd that these servers have 61 | # become visible after you go on-line. 62 | 63 | ! server 0.pool.ntp.org offline 64 | ! server 1.pool.ntp.org offline 65 | ! server 2.pool.ntp.org offline 66 | 67 | # You may want to specify NTP 'peers' instead. If you run a network 68 | # with a lot of computers and want several computers running chrony to 69 | # have the 'front-line' interface to the public NTP servers, you can 70 | # 'peer' these machines together to increase robustness. 71 | 72 | ! peer ntp0.my-company.com 73 | 74 | # There are other options to the 'server' and 'peer' directives that you 75 | # might want to use. For example, you can ignore measurements whose 76 | # round-trip-time is too large (indicating that the measurement is 77 | # probably useless, because you don't know which way the measurement 78 | # message got held up.) Consult the full documentation for details. 79 | 80 | ####################################################################### 81 | ### AVOIDING POTENTIALLY BOGUS CHANGES TO YOUR CLOCK 82 | # 83 | # To avoid changes being made to your computer's gain/loss compensation 84 | # when the measurement history is too erratic, you might want to enable 85 | # one of the following lines. The first seems good for dial-up (or 86 | # other high-latency connections like slow leased lines), the second 87 | # seems OK for a LAN environment. 88 | 89 | ! maxupdateskew 100 90 | maxupdateskew 5 91 | 92 | ####################################################################### 93 | ### FILENAMES ETC 94 | # Chrony likes to keep information about your computer's clock in files. 95 | # The 'driftfile' stores the computer's clock gain/loss rate in parts 96 | # per million. When chronyd starts, the system clock can be tuned 97 | # immediately so that it doesn't gain or lose any more time. You 98 | # generally want this, so it is uncommented. 99 | 100 | driftfile /var/lib/chrony/drift 101 | 102 | # If you want to use the program called chronyc to configure aspects of 103 | # chronyd's operation once it is running (e.g. tell it the Internet link 104 | # has gone up or down), you need a password. This is stored in the 105 | # following keys file. (You also need keys to support authenticated NTP 106 | # exchanges between cooperating machines.) Again, this option is 107 | # assumed by default. 108 | 109 | keyfile /etc/chrony.keys 110 | 111 | # Tell chronyd which numbered key in the file is used as the password 112 | # for chronyc. (You can pick any integer up to 2**32-1. '1' is just a 113 | # default. Using another value will _NOT_ increase security.) 114 | 115 | commandkey 1 116 | 117 | # chronyd can save the measurement history for the servers to files when 118 | # it it exits. This is useful in 2 situations: 119 | # 120 | # 1. On Linux, if you stop chronyd and restart it with '-r' (e.g. after 121 | # an upgrade), the old measurements will still be relevant when chronyd 122 | # is restarted. This will reduce the time needed to get accurate 123 | # gain/loss measurements, especially with a dial-up link. 124 | # 125 | # 2. Again on Linux, if you use the RTC support and start chronyd with 126 | # '-r -s' on bootup, measurements from the last boot will still be 127 | # useful (the real time clock is used to 'flywheel' chronyd between 128 | # boots). 129 | # 130 | # Enable these two options to use this. 131 | 132 | dumponexit 133 | dumpdir /var/lib/chrony 134 | 135 | # chronyd writes its process ID to a file. If you try to start a second 136 | # copy of chronyd, it will detect that the process named in the file is 137 | # still running and bail out. If you want to change the path to the PID 138 | # file, uncomment this line and edit it. The default path is shown. 139 | 140 | ! pidfile /var/run/chronyd.pid 141 | 142 | ####################################################################### 143 | ### INITIAL CLOCK CORRECTION 144 | # This option is only useful if your NTP servers are visible at boot 145 | # time. This probably means you are on a LAN. If so, the following 146 | # option will choose the best-looking of the servers and correct the 147 | # system time to that. The value '10' means that if the error is less 148 | # than 10 seconds, it will be gradually removed by speeding up or 149 | # slowing down your computer's clock until it is correct. If the error 150 | # is above 10 seconds, an immediate time jump will be applied to correct 151 | # it. Some software can get upset if the system clock jumps (especially 152 | # backwards), so be careful! 153 | 154 | makestep 10 1 155 | 156 | ####################################################################### 157 | ### LOGGING 158 | # If you want to log information about the time measurements chronyd has 159 | # gathered, you might want to enable the following lines. You probably 160 | # only need this if you really enjoy looking at the logs, you want to 161 | # produce some graphs of your system's timekeeping performance, or you 162 | # need help in debugging a problem. 163 | 164 | logdir /var/log/chrony 165 | ! log measurements statistics tracking 166 | 167 | # If you have real time clock support enabled (see below), you might want 168 | # this line instead: 169 | 170 | log measurements statistics tracking rtc 171 | 172 | ####################################################################### 173 | ### ACTING AS AN NTP SERVER 174 | # You might want the computer to be an NTP server for other computers. 175 | # e.g. you might be running chronyd on a dial-up machine that has a LAN 176 | # sitting behind it with several 'satellite' computers on it. 177 | # 178 | # By default, chronyd does not allow any clients to access it. You need 179 | # to explicitly enable access using 'allow' and 'deny' directives. 180 | # 181 | # e.g. to enable client access from the 192.168.*.* class B subnet, 182 | 183 | ! allow 192.168/16 184 | 185 | # .. but disallow the 192.168.100.* subnet of that, 186 | 187 | ! deny 192.168.100/24 188 | 189 | # You can have as many allow and deny directives as you need. The order 190 | # is unimportant. 191 | 192 | # If you want chronyd to act as an NTP broadcast server, enable and edit 193 | # (and maybe copy) the following line. This means that a broadcast 194 | # packet is sent to the address 192.168.1.255 every 60 seconds. The 195 | # address MUST correspond to the broadcast address of one of the network 196 | # interfaces on your machine. If you have multiple network interfaces, 197 | # add a broadcast line for each. 198 | 199 | ! broadcast 60 192.168.1.255 200 | 201 | # If you want to present your computer's time for others to synchronise 202 | # with, even if you don't seem to be synchronised to any NTP servers 203 | # yourself, enable the following line. The value 10 may be varied 204 | # between 1 and 15. You should avoid small values because you will look 205 | # like a real NTP server. The value 10 means that you appear to be 10 206 | # NTP 'hops' away from an authoritative source (atomic clock, GPS 207 | # receiver, radio clock etc). 208 | 209 | ! local stratum 10 210 | 211 | # Normally, chronyd will keep track of how many times each client 212 | # machine accesses it. The information can be accessed by the 'clients' 213 | # command of chronyc. You can disable this facility by uncommenting the 214 | # following line. This will save a bit of memory if you have many 215 | # clients. 216 | 217 | ! noclientlog 218 | 219 | # The clientlog size is limited to 512KB by default. If you have many 220 | # clients, especially in many different subnets, you might want to 221 | # increase the limit. 222 | 223 | ! clientloglimit 4194304 224 | 225 | ####################################################################### 226 | ### REPORTING BIG CLOCK CHANGES 227 | # Perhaps you want to know if chronyd suddenly detects any large error 228 | # in your computer's clock. This might indicate a fault or a problem 229 | # with the server(s) you are using, for example. 230 | # 231 | # The next option causes a message to be written to syslog when chronyd 232 | # has to correct an error above 0.5 seconds (you can use any amount you 233 | # like). 234 | 235 | logchange 0.5 236 | 237 | # The next option will send email to the named person when chronyd has 238 | # to correct an error above 0.5 seconds. (If you need to send mail to 239 | # several people, you need to set up a mailing list or sendmail alias 240 | # for them and use the address of that.) 241 | 242 | ! mailonchange wibble@foobar.org 0.5 243 | 244 | ####################################################################### 245 | ### COMMAND ACCESS 246 | # The program chronyc is used to show the current operation of chronyd 247 | # and to change parts of its configuration whilst it is running. 248 | 249 | # Normally, chronyd will only allow connections from chronyc on the same 250 | # machine as itself. This is for security. If you have a subnet 251 | # 192.168.*.* and you want to be able to use chronyc from any machine on 252 | # it, you could uncomment the following line. (Edit this to your own 253 | # situation.) 254 | 255 | ! cmdallow 192.168/16 256 | 257 | # You can add as many 'cmdallow' and 'cmddeny' lines as you like. The 258 | # syntax and meaning is the same as for 'allow' and 'deny', except that 259 | # 'cmdallow' and 'cmddeny' control access to the chronyd's command port. 260 | 261 | # NOTE, even if the host where you run chronyc is granted access, you 262 | # still need a command key set up and you have to know the password to 263 | # put into chronyc to allow you to modify chronyd's parameters. By 264 | # default all you can do is view information about chronyd's operation. 265 | 266 | # Some people have reported that the need the following line to allow 267 | # chronyc to work even on the same machine. This should not be 268 | # necessary, and the problem is being investigated. You can leave this 269 | # line enabled, as it's benign otherwise. 270 | 271 | cmdallow 127.0.0.1 272 | 273 | ####################################################################### 274 | ### REAL TIME CLOCK 275 | # chronyd can characterise the system's real-time clock. This is the 276 | # clock that keeps running when the power is turned off, so that the 277 | # machine knows the approximate time when it boots again. The error at 278 | # a particular epoch and gain/loss rate can be written to a file and 279 | # used later by chronyd when it is started with the '-s' option. 280 | # 281 | # You need to have 'enhanced RTC support' compiled into your Linux 282 | # kernel. (Note, these options apply only to Linux.) 283 | 284 | ! rtcfile /var/lib/chrony/rtc 285 | 286 | # Your RTC can be set to keep Universal Coordinated Time (UTC) or local 287 | # time. (Local time means UTC +/- the effect of your timezone.) If you 288 | # use UTC, chronyd will function correctly even if the computer is off 289 | # at the epoch when you enter or leave summer time (aka daylight saving 290 | # time). However, if you dual boot your system with Microsoft Windows, 291 | # that will work better if your RTC maintains local time. You take your 292 | # pick! 293 | 294 | rtconutc 295 | 296 | # By default chronyd assumes that the enhanced RTC device is accessed as 297 | # /dev/rtc. If it's accessed somewhere else on your system (e.g. you're 298 | # using devfs), uncomment and edit the following line. 299 | 300 | ! rtcdevice /dev/misc/rtc 301 | 302 | ####################################################################### 303 | ### REAL TIME SCHEDULER 304 | # This directive tells chronyd to use the real-time FIFO scheduler with the 305 | # specified priority (which must be between 0 and 100). This should result 306 | # in reduced latency. You don't need it unless you really have a requirement 307 | # for extreme clock stability. Works only on Linux. Note that the "-P" 308 | # command-line switch will override this. 309 | 310 | ! sched_priority 1 311 | 312 | ####################################################################### 313 | ### LOCKING CHRONYD INTO RAM 314 | # This directive tells chronyd to use the mlockall() syscall to lock itself 315 | # into RAM so that it will never be paged out. This should result in reduced 316 | # latency. You don't need it unless you really have a requirement 317 | # for extreme clock stability. Works only on Linux. Note that the "-m" 318 | # command-line switch will also enable this feature. 319 | 320 | ! lock_all 321 | -------------------------------------------------------------------------------- /files/mozilla-profilemanager.desktop: -------------------------------------------------------------------------------- 1 | ############################################################## 2 | # WARNING - WARNING - WARNING 3 | # This file is managed by the puppet-archlinux-macbookretina 4 | # puppet module. Any local changes made here will be 5 | # overwritten on the next Puppet run. Please change the 6 | # file in the puppet module for persistent changes. 7 | ############################################################## 8 | 9 | [Desktop Entry] 10 | Version=1.0 11 | Name=Mozilla ProfileManager 12 | GenericName=Web Browser 13 | GenericName[ca]=Navegador web 14 | GenericName[cs]=Webový prohlížeč 15 | GenericName[es]=Navegador web 16 | GenericName[fa]=مرورگر اینترنتی 17 | GenericName[fi]=WWW-selain 18 | GenericName[fr]=Navigateur Web 19 | GenericName[hu]=Webböngésző 20 | GenericName[it]=Browser Web 21 | GenericName[ja]=ウェブ・ブラウザ 22 | GenericName[ko]=웹 브라우저 23 | GenericName[nb]=Nettleser 24 | GenericName[nl]=Webbrowser 25 | GenericName[nn]=Nettlesar 26 | GenericName[no]=Nettleser 27 | GenericName[pl]=Przeglądarka WWW 28 | GenericName[pt]=Navegador Web 29 | GenericName[pt_BR]=Navegador Web 30 | GenericName[sk]=Internetový prehliadač 31 | GenericName[sv]=Webbläsare 32 | Comment=Browse the Web 33 | Comment[ca]=Navegueu per el web 34 | Comment[cs]=Prohlížení stránek World Wide Webu 35 | Comment[de]=Im Internet surfen 36 | Comment[es]=Navegue por la web 37 | Comment[fa]=صفحات شبکه جهانی اینترنت را مرور نمایید 38 | Comment[fi]=Selaa Internetin WWW-sivuja 39 | Comment[fr]=Navigue sur Internet 40 | Comment[hu]=A világháló böngészése 41 | Comment[it]=Esplora il web 42 | Comment[ja]=ウェブを閲覧します 43 | Comment[ko]=웹을 돌아 다닙니다 44 | Comment[nb]=Surf på nettet 45 | Comment[nl]=Verken het internet 46 | Comment[nn]=Surf på nettet 47 | Comment[no]=Surf på nettet 48 | Comment[pl]=Przeglądanie stron WWW 49 | Comment[pt]=Navegue na Internet 50 | Comment[pt_BR]=Navegue na Internet 51 | Comment[sk]=Prehliadanie internetu 52 | Comment[sv]=Surfa på webben 53 | Exec=/usr/local/bin/profilemanager/run-mozilla.sh /usr/local/bin/profilemanager/profilemanager-bin %u 54 | Icon=firefox 55 | Terminal=false 56 | Type=Application 57 | MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https; 58 | StartupNotify=true 59 | Categories=Network;WebBrowser; 60 | Keywords=web;browser;internet; 61 | X-Desktop-File-Install-Version=0.21 62 | -------------------------------------------------------------------------------- /lib/puppet/provider/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jantman/puppet-archlinux-workstation/54702178bff3c1a8cbd6030b71459da89b239000/lib/puppet/provider/.gitkeep -------------------------------------------------------------------------------- /lib/puppet/type/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jantman/puppet-archlinux-workstation/54702178bff3c1a8cbd6030b71459da89b239000/lib/puppet/type/.gitkeep -------------------------------------------------------------------------------- /locales/config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # This is the project-specific configuration file for setting up 3 | # fast_gettext for your project. 4 | gettext: 5 | # This is used for the name of the .pot and .po files; they will be 6 | # called .pot? 7 | project_name: jantman-archlinux_workstation 8 | # This is used in comments in the .pot and .po files to indicate what 9 | # project the files belong to and should bea little more desctiptive than 10 | # 11 | package_name: jantman-archlinux_workstation 12 | # The locale that the default messages in the .pot file are in 13 | default_locale: en 14 | # The email used for sending bug reports. 15 | bugs_address: jason@jasonantman.com 16 | # The holder of the copyright. 17 | copyright_holder: Jason Antman 18 | # This determines which comments in code should be eligible for translation. 19 | # Any comments that start with this string will be externalized. (Leave 20 | # empty to include all.) 21 | comments_tag: TRANSLATOR 22 | # Patterns for +Dir.glob+ used to find all files that might contain 23 | # translatable content, relative to the project root directory 24 | source_files: 25 | - './lib/**/*.rb' 26 | 27 | -------------------------------------------------------------------------------- /manifests/all.pp: -------------------------------------------------------------------------------- 1 | # 2 | # Include ALL other archlinux_workstation classes. 3 | # 4 | # **WARNING - except on a brand new system, this is probably NOT what you want to do!** 5 | # 6 | # See {file:README.markdown README.markdown} for advanced usage. 7 | # 8 | class archlinux_workstation::all { 9 | 10 | if ! defined(Class['archlinux_workstation']) { 11 | fail('You must include the base archlinux_workstation class before using any subclasses') 12 | } 13 | 14 | # variable access 15 | include archlinux_workstation 16 | 17 | # repos 18 | include archlinux_workstation::repos::jantman 19 | include archlinux_workstation::repos::multilib 20 | 21 | # ALL classes in archlinux_workstation module 22 | include archlinux_workstation::base_packages 23 | include archlinux_workstation::chrony 24 | include archlinux_workstation::cronie 25 | include archlinux_workstation::cups 26 | include archlinux_workstation::dkms 27 | include archlinux_workstation::docker 28 | include archlinux_workstation::makepkg 29 | include archlinux_workstation::ssh 30 | include archlinux_workstation::sudo 31 | 32 | class {'archlinux_workstation::xorg': } 33 | -> class {'archlinux_workstation::kde': } 34 | -> class {'archlinux_workstation::sddm': } 35 | -> class {'archlinux_workstation::networkmanager': } 36 | 37 | # userapps 38 | archlinux_workstation::userapps::rvm { $archlinux_workstation::username : } 39 | include archlinux_workstation::userapps::virtualbox 40 | 41 | } 42 | -------------------------------------------------------------------------------- /manifests/base_packages.pp: -------------------------------------------------------------------------------- 1 | # 2 | # Collection of base packages that we want installed on every system, and some 3 | # packages to never be installed. See source for current package lists. 4 | # 5 | class archlinux_workstation::base_packages { 6 | 7 | if ! defined(Class['archlinux_workstation']) { 8 | fail('You must include the base archlinux_workstation class before using any subclasses') 9 | } 10 | 11 | $packages_absent = [ 12 | 'lynx', 13 | ] 14 | 15 | $packages_present = [ 16 | 'bind', 17 | 'dialog', 18 | 'dmidecode', 19 | 'links', 20 | 'lsb-release', 21 | 'lsof', 22 | 'lsscsi', 23 | 'net-tools', 24 | 'screen', 25 | 'ttf-dejavu', 26 | 'vim', 27 | 'wget', 28 | ] 29 | 30 | package {$packages_present : ensure => present, } 31 | package {$packages_absent : ensure => absent, } 32 | } 33 | -------------------------------------------------------------------------------- /manifests/chrony.pp: -------------------------------------------------------------------------------- 1 | # 2 | # Install and configure [Chrony](https://wiki.archlinux.org/index.php/Chrony), 3 | # a roaming/laptop friendly NTP client, as well as the 4 | # [networkmanager-dispatcher-chrony](https://aur.archlinux.org/packages/networkmanager-dispatcher-chrony/) 5 | # script for it. 6 | # 7 | # @param chrony_password The password that other clients will use to 8 | # connect to chrony. Our configuration only has chrony listening on 9 | # localhost/127.0.0.1, so this shouldn't be important. 10 | # 11 | class archlinux_workstation::chrony ( 12 | String $chrony_password = 'd83ja72.f83,8wHUW94', 13 | ) { 14 | 15 | if ! defined(Class['archlinux_workstation']) { 16 | fail('You must include the base archlinux_workstation class before using any subclasses') 17 | } 18 | 19 | package {'chrony': 20 | ensure => present, 21 | } 22 | 23 | # nm hooks to tell chrony when we're on/offline 24 | # this is an AUR package, which is in my repo 25 | package {'networkmanager-dispatcher-chrony': 26 | ensure => present, 27 | require => Class['archlinux_workstation::repos::jantman'], 28 | } 29 | 30 | file {'/etc/chrony.conf': 31 | ensure => present, 32 | owner => 'root', 33 | group => 'root', 34 | mode => '0644', 35 | source => 'puppet:///modules/archlinux_workstation/chrony.conf', 36 | require => Package['chrony'], 37 | notify => Service['chronyd'], 38 | } 39 | 40 | file {'/etc/chrony.keys': 41 | ensure => present, 42 | owner => 'root', 43 | group => 'root', 44 | mode => '0640', 45 | content => "1 ${chrony_password}", 46 | require => Package['chrony'], 47 | notify => Service['chronyd'], 48 | } 49 | 50 | service {'chronyd': 51 | ensure => running, 52 | enable => true, 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /manifests/cronie.pp: -------------------------------------------------------------------------------- 1 | # 2 | # Install and run the [cronie](https://fedorahosted.org/cronie/) cron daemon. 3 | # Per the [Arch wiki cron entry](https://wiki.archlinux.org/index.php/cron), 4 | # no cron daemon comes default with Arch. 5 | # 6 | # @param mail_command If defined, will run `cronie` 7 | # with ``-m ${mail_command}`` to send mail via this command. 8 | # See `man 8 cron` for more information. 9 | # 10 | class archlinux_workstation::cronie ( 11 | Variant[String, Undef] $mail_command = undef, 12 | ) { 13 | 14 | if ! defined(Class['archlinux_workstation']) { 15 | fail('You must include the base archlinux_workstation class before using any subclasses') 16 | } 17 | 18 | package {'cronie': 19 | ensure => present, 20 | } 21 | 22 | if $mail_command { 23 | exec {'cronie-daemon-reload': 24 | command => '/usr/bin/systemctl daemon-reload', 25 | refreshonly => true, 26 | } 27 | 28 | file {'cronie.service.d': 29 | ensure => directory, 30 | path => '/usr/lib/systemd/system/cronie.service.d', 31 | owner => 'root', 32 | group => 'root', 33 | mode => '0755', 34 | require => Package['cronie'], 35 | } 36 | 37 | $mail_cmd_content = "# Managed by Puppet - archlinux_workstation::cronie class 38 | [Service] 39 | ExecStart= 40 | ExecStart=/usr/bin/crond -n -m ${mail_command} 41 | " 42 | 43 | file {'cronie_mail_command.conf': 44 | ensure => present, 45 | path => '/usr/lib/systemd/system/cronie.service.d/cronie_mail_command.conf', 46 | owner => 'root', 47 | group => 'root', 48 | mode => '0644', 49 | require => File['cronie.service.d'], 50 | content => $mail_cmd_content, 51 | notify => [Exec['cronie-daemon-reload'], Service['cronie']], 52 | } 53 | 54 | $svc_require = [Package['cronie'], File['cronie_mail_command.conf'], Exec['cronie-daemon-reload']] 55 | } else { 56 | $svc_require = [Package['cronie']] 57 | } 58 | 59 | service {'cronie': 60 | ensure => running, 61 | enable => true, 62 | require => $svc_require, 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /manifests/cups.pp: -------------------------------------------------------------------------------- 1 | # 2 | # Install [CUPS](https://wiki.archlinux.org/index.php/CUPS) printing and related 3 | # packages; run cups service. 4 | # 5 | class archlinux_workstation::cups { 6 | 7 | $cups_packages = [ 8 | 'cups', 9 | 'cups-filters', 10 | 'cups-pdf', 11 | 'ghostscript', 12 | 'gsfonts', 13 | 'gutenprint', 14 | 'libcups', 15 | ] 16 | 17 | package {$cups_packages: 18 | ensure => present, 19 | } 20 | 21 | service {'cups': 22 | ensure => running, 23 | enable => true, 24 | require => Package['cups'], 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /manifests/dkms.pp: -------------------------------------------------------------------------------- 1 | # 2 | # Install [DKMS](https://wiki.archlinux.org/index.php/Dynamic_Kernel_Module_Support) 3 | # 4 | class archlinux_workstation::dkms { 5 | 6 | if ! defined(Class['archlinux_workstation']) { 7 | fail('You must include the base archlinux_workstation class before using any subclasses') 8 | } 9 | 10 | package {'dkms': 11 | ensure => present, 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /manifests/docker.pp: -------------------------------------------------------------------------------- 1 | # 2 | # Install and run [Docker](https://wiki.archlinux.org/index.php/Docker); add 3 | # ``$archlinux_workstation::username`` to the ``docker`` group. This class wraps 4 | # an instance of the [garethr/docker](https://forge.puppet.com/garethr/docker) 5 | # module. 6 | # 7 | # @param service_state what state to ensure the Docker service in. This is mainly 8 | # useful for acceptance testing the module or building system images. 9 | # 10 | class archlinux_workstation::docker( 11 | Enum['stopped', 'running'] $service_state = 'running', 12 | ) { 13 | 14 | if ! defined(Class['archlinux_workstation']) { 15 | fail('You must include the base archlinux_workstation class before using any subclasses') 16 | } 17 | 18 | include archlinux_workstation 19 | 20 | if ! defined(File['/etc/conf.d']) { 21 | file {'/etc/conf.d': 22 | ensure => directory, 23 | owner => 'root', 24 | group => 'root', 25 | mode => '0755', 26 | before => Class['docker'], 27 | } 28 | } 29 | 30 | class {'docker': 31 | service_state => $service_state, 32 | } 33 | 34 | # add the user defined in init.pp to docker group with plusignment 35 | User<| title == $archlinux_workstation::username |> { 36 | groups +> ['docker'], 37 | require +> [ Class['docker'] ], 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /manifests/init.pp: -------------------------------------------------------------------------------- 1 | # 2 | # Main class for archlinux_workstation. 3 | # 4 | # See {file:README.markdown README.markdown} for advanced usage. 5 | # 6 | # This class sets up your user and group and provides variables for other 7 | # classes in the module. 8 | # 9 | # @param username Your login username. Used to create your account, add you to 10 | # certain groups, etc. 11 | # @param realname The user's real name, to be used in the passwd comment/GECOS 12 | # field. Defaults to ``$username`` if not specified. 13 | # @param user_home Path to ``$username``'s home directory. Used for classes that put 14 | # files in the user's home directory. Default: ``/home/${username}``. 15 | # @param shell the user's login shell. 16 | # @param user_groups list of supplementary groups that this user should be a member of. 17 | # @param makepkg_packager String to set as PACKAGER in makepkg.conf 18 | # (see ); 19 | # if left blank, PACKAGER will be omitted and built packages will default to 20 | # "Unknown Packager". 21 | # 22 | class archlinux_workstation ( 23 | String $username = undef, 24 | Variant[String, Undef] $realname = undef, 25 | Variant[String, Undef] $user_home = undef, 26 | String $shell = '/bin/bash', 27 | Array[String] $user_groups = ['sys'], 28 | Variant[String, Undef] $makepkg_packager = undef, 29 | ) { 30 | 31 | # make sure we're on arch, otherwise fail 32 | if $::osfamily != 'Archlinux' { 33 | fail("${::operatingsystem} not supported") 34 | } 35 | 36 | # user_home - default uses another param 37 | if ! $user_home { 38 | $real_user_home = "/home/${username}" 39 | } else { 40 | $real_user_home = $user_home 41 | } 42 | 43 | # realname - default uses another param 44 | if $realname { 45 | $real_name = $realname 46 | } else { 47 | $real_name = $username 48 | } 49 | 50 | validate_re($username, '^.+$', 'Parameter username must be a string for class archlinux_workstation') 51 | validate_absolute_path($real_user_home) 52 | 53 | # we make the user a virtual resource and then realize it so that other 54 | # classes can append to the 'groups' attribute using plusignment 55 | @user { $username: 56 | ensure => present, 57 | name => $username, 58 | comment => $real_name, 59 | gid => $username, 60 | home => $real_user_home, 61 | managehome => true, 62 | shell => $shell, 63 | groups => $user_groups, 64 | require => [ Group[$username] ], 65 | } 66 | 67 | User <| title == $username |> 68 | 69 | group { $username: 70 | ensure => present, 71 | name => $username, 72 | system => false, 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /manifests/kde.pp: -------------------------------------------------------------------------------- 1 | # 2 | # Perform a full installation of [KDE](https://wiki.archlinux.org/index.php/KDE) 3 | # via the "kde" package group. 4 | # 5 | class archlinux_workstation::kde { 6 | 7 | if ! defined(Class['archlinux_workstation']) { 8 | fail('You must include the base archlinux_workstation class before using any subclasses') 9 | } 10 | 11 | package {['plasma-meta', 'kde-applications-meta']: 12 | ensure => present, 13 | } 14 | 15 | # phonon/vlc audio; we install both backends 16 | $phonon_packages = [ 17 | 'phonon-qt5', 18 | 'phonon-qt5-gstreamer', 19 | 'phonon-qt5-vlc', 20 | ] 21 | package { $phonon_packages: 22 | ensure => present, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /manifests/makepkg.pp: -------------------------------------------------------------------------------- 1 | # 2 | # Sets up [makepkg](https://wiki.archlinux.org/index.php/Makepkg) configuration 3 | # for Arch Linux (``/etc/makepkg.conf``) for system-optimized compiling and 4 | # compiling in /tmp tmpfs, and configures systemd to create tmpfs compile 5 | # directories on boot. 6 | # 7 | # @param make_flags additional flags to pass to make via ``makepkg.conf``. 8 | # Defaults to setting ``-j`` (number of available processors for parallelization) 9 | # to the system's number of processors. 10 | # 11 | class archlinux_workstation::makepkg ( 12 | String $make_flags = "-j${facts['processors']['count']}", 13 | ){ 14 | 15 | if ! defined(Class['archlinux_workstation']) { 16 | fail('You must include the base archlinux_workstation class before using any subclasses') 17 | } 18 | 19 | # variable access 20 | include archlinux_workstation 21 | 22 | $makepkg_user = $::archlinux_workstation::username 23 | $makepkg_packager = $::archlinux_workstation::makepkg_packager 24 | 25 | # base config files 26 | # Template Uses: 27 | # - $make_flags 28 | file {'/etc/makepkg.conf': 29 | ensure => present, 30 | owner => 'root', 31 | group => 'root', 32 | mode => '0644', 33 | content => template('archlinux_workstation/makepkg.conf.erb'), 34 | } 35 | 36 | # these are needed for compiling packages under /tmp using makepkg 37 | file {'/tmp/sources': 38 | ensure => directory, 39 | owner => $archlinux_workstation::username, 40 | group => 'wheel', 41 | mode => '0775', 42 | } 43 | 44 | file {'/tmp/makepkg': 45 | ensure => directory, 46 | owner => $archlinux_workstation::username, 47 | group => 'wheel', 48 | mode => '0775', 49 | } 50 | 51 | file {'/tmp/makepkglogs': 52 | ensure => directory, 53 | owner => $archlinux_workstation::username, 54 | group => 'wheel', 55 | mode => '0775', 56 | } 57 | 58 | file {'/etc/tmpfiles.d/makepkg_puppet.conf': 59 | ensure => present, 60 | owner => 'root', 61 | group => 'root', 62 | mode => '0644', 63 | content => "# managed by archlinux_workstation::makepkg puppet class 64 | D /tmp/sources 0775 ${archlinux_workstation::username} wheel 65 | D /tmp/makepkg 0775 ${archlinux_workstation::username} wheel 66 | D /tmp/makepkglogs 0775 ${archlinux_workstation::username} wheel", 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /manifests/networkmanager.pp: -------------------------------------------------------------------------------- 1 | # 2 | # Install and setup [networkmanager](https://wiki.archlinux.org/index.php/NetworkManager), 3 | # ensure dhcpcd is stopped and nm is running. If ``archlinux_workstation::kde`` is defined, also 4 | # install ``kdeplasma-applets-networkmanagement``. 5 | # 6 | class archlinux_workstation::networkmanager { 7 | 8 | if ! defined(Class['archlinux_workstation']) { 9 | fail('You must include the base archlinux_workstation class before using any subclasses') 10 | } 11 | 12 | package {'networkmanager': 13 | ensure => present, 14 | } 15 | 16 | if defined(Class['archlinux_workstation::kde']) { 17 | package {'plasma-nm': 18 | ensure => present, 19 | require => Package['networkmanager'], 20 | } 21 | } 22 | 23 | service {'NetworkManager': 24 | ensure => running, 25 | enable => true, 26 | require => Package['networkmanager'], 27 | } 28 | 29 | $ifs = split($::interfaces, ',') 30 | 31 | $ifs.each |String $ifname| { 32 | service {"dhcpcd@${ifname}": 33 | ensure => stopped, 34 | enable => false, 35 | require => Service['NetworkManager'], 36 | } 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /manifests/pacman_repo.pp: -------------------------------------------------------------------------------- 1 | # 2 | # Manage a repository configured in ``/etc/pacman.conf``. 3 | # 4 | # This manages repos in ``/etc/pacman.conf`` via the 5 | # [puppetlabs/inifile](https://forge.puppet.com/puppetlabs/inifile) module. 6 | # 7 | # @param repo_name The name of the repository. For Pacman repos, this string is 8 | # __not__ user-configurable; it must match the name of the database file in the repo. 9 | # @param siglevel The signature verification level for this repository; see the 10 | # [pacman man page](https://www.archlinux.org/pacman/pacman.conf.5.html#SC) for 11 | # more information. 12 | # @param server URL to the pacman repository. Either this or include_file must be specified. 13 | # @param include_file path to mirrorlist file to include. Either this or server must be specified. 14 | # 15 | define archlinux_workstation::pacman_repo ( 16 | String $repo_name = $title, 17 | String $siglevel = 'Optional TrustedOnly', 18 | Variant[String, Undef] $server = undef, 19 | Variant[String, Undef] $include_file = undef, 20 | ) { 21 | 22 | if (! $server and ! $include_file) { 23 | fail("Either server or include_file must be specified on define archlinux_workstation::pacman_repo[${title}]") 24 | } 25 | 26 | if $server { 27 | validate_re($server, '^.+$', "Parameter server (URL) must be specified on define archlinux_workstation::pacman_repo[${title}]") 28 | 29 | ini_setting { "archlinux_workstation-pacman_repo-${title}-siglevel": 30 | ensure => present, 31 | path => '/etc/pacman.conf', 32 | section => $repo_name, 33 | setting => 'SigLevel', 34 | value => $siglevel, 35 | notify => Exec['pacman_repo-Sy'], 36 | } 37 | -> ini_setting { "archlinux_workstation-pacman_repo-${title}-server": 38 | ensure => present, 39 | path => '/etc/pacman.conf', 40 | section => $repo_name, 41 | setting => 'Server', 42 | value => $server, 43 | notify => Exec['pacman_repo-Sy'], 44 | } 45 | } 46 | 47 | if $include_file { 48 | validate_absolute_path($include_file) 49 | 50 | ini_setting { "archlinux_workstation-pacman_repo-${title}-include": 51 | ensure => present, 52 | path => '/etc/pacman.conf', 53 | section => $repo_name, 54 | setting => 'Include', 55 | value => $include_file, 56 | notify => Exec['pacman_repo-Sy'], 57 | } 58 | } 59 | 60 | if ! defined(Exec['pacman_repo-Sy']) { 61 | exec { 'pacman_repo-Sy': 62 | command => '/usr/bin/pacman -Sy', 63 | refreshonly => true, 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /manifests/repos/jantman.pp: -------------------------------------------------------------------------------- 1 | # 2 | # Sets up jantman's personal pacman repository 3 | # (http://archrepo.jasonantman.com/current). See that URL for a package index. 4 | # 5 | class archlinux_workstation::repos::jantman { 6 | 7 | if ! defined(Class['archlinux_workstation']) { 8 | fail('You must include the base archlinux_workstation class before using any subclasses') 9 | } 10 | 11 | archlinux_workstation::pacman_repo { 'jantman': 12 | server => 'http://archrepo.jasonantman.com/current', 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /manifests/repos/multilib.pp: -------------------------------------------------------------------------------- 1 | # 2 | # Sets up the [Multilib](https://wiki.archlinux.org/index.php/Multilib) 3 | # pacman repository. 4 | # 5 | class archlinux_workstation::repos::multilib { 6 | 7 | if ! defined(Class['archlinux_workstation']) { 8 | fail('You must include the base archlinux_workstation class before using any subclasses') 9 | } 10 | 11 | archlinux_workstation::pacman_repo { 'multilib': 12 | include_file => '/etc/pacman.d/mirrorlist' 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /manifests/sddm.pp: -------------------------------------------------------------------------------- 1 | # 2 | # Install and run [SDDM](https://wiki.archlinux.org/index.php/SDDM), 3 | # the Simple Desktop Display Manager. 4 | # 5 | # @param service_ensure what state to ensure the SDDM service in. This is mainly 6 | # useful for acceptance testing the module or building system images. 7 | class archlinux_workstation::sddm( 8 | Enum['stopped', 'running'] $service_ensure = running, 9 | ) { 10 | 11 | if ! defined(Class['archlinux_workstation']) { 12 | fail('You must include the base archlinux_workstation class before using any subclasses') 13 | } 14 | 15 | package {'sddm': 16 | ensure => present, 17 | } 18 | 19 | service {'sddm': 20 | ensure => $service_ensure, 21 | enable => true, 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /manifests/ssh.pp: -------------------------------------------------------------------------------- 1 | # 2 | # Configure [SSH](https://wiki.archlinux.org/index.php/Secure_Shell) server via 3 | # [saz/ssh](https://forge.puppet.com/saz/ssh) and allow access only by your username. 4 | # 5 | # @param allow_users Usernames to allow to login via SSH. If left default (undef), 6 | # ``$archlinux_workstation::username`` will be used. If ``$::virtual == 'virtualbox'``, 7 | # ``vagrant`` will be appended to the list. 8 | # @param permit_root Whether or not to permit root login. 9 | # @param extra_options extra configuration options to include in sshd_config. 10 | # 11 | class archlinux_workstation::ssh ( 12 | Variant[Undef, Array[String]] $allow_users = undef, 13 | Boolean $permit_root = false, 14 | Variant[Undef, Hash] $extra_options = undef, 15 | ){ 16 | 17 | if ! defined(Class['archlinux_workstation']) { 18 | fail('You must include the base archlinux_workstation class before using any subclasses') 19 | } 20 | 21 | # variable access 22 | include archlinux_workstation 23 | 24 | if $allow_users { 25 | $tmp_users = $allow_users 26 | } else { 27 | $tmp_users = [$archlinux_workstation::username] 28 | } 29 | 30 | if $permit_root { 31 | $allow_root = 'yes' 32 | $tmp_users2 = $tmp_users + ['root'] 33 | } else { 34 | $allow_root = 'no' 35 | $tmp_users2 = $tmp_users 36 | } 37 | 38 | # add 'vagrant' to allow users if on virtualbox 39 | if $::virtual == 'virtualbox' { 40 | notify {'adding vagrant to list of SSH allowed users, per $::virtual fact': } 41 | $real_allow_users = $tmp_users2 + ['vagrant'] 42 | } else { 43 | $real_allow_users = $tmp_users2 44 | } 45 | 46 | $base_options = { 47 | 'AcceptEnv' => ['LANG', 'LC_*', 'DISPLAY'], 48 | 'AllowUsers' => $real_allow_users, 49 | 'AuthorizedKeysFile' => '.ssh/authorized_keys', 50 | 'GSSAPIAuthentication' => 'no', 51 | 'KerberosAuthentication' => 'no', 52 | 'PasswordAuthentication' => 'no', 53 | 'PermitRootLogin' => $allow_root, 54 | 'Port' => [22], 55 | 'PubkeyAuthentication' => 'yes', 56 | 'SyslogFacility' => 'AUTH', 57 | 'X11Forwarding' => 'yes', 58 | } 59 | 60 | if $extra_options { 61 | validate_hash($extra_options) 62 | $final_options = merge($base_options, $extra_options) 63 | } else { 64 | $final_options = $base_options 65 | } 66 | 67 | # saz/ssh 68 | class { 'ssh::server': 69 | storeconfigs_enabled => false, 70 | options => $final_options, 71 | } 72 | 73 | 74 | } 75 | -------------------------------------------------------------------------------- /manifests/sudo.pp: -------------------------------------------------------------------------------- 1 | # 2 | # Sets up [sudo](https://wiki.archlinux.org/index.php/Sudo), secure global 3 | # defaults, and permissions for your user. This class wraps the 4 | # [saz/sudo](https://forge.puppet.com/saz/sudo) module. If ``$::virtual == 'virtualbox'``, 5 | # ``vagrant`` will also be given sudo permissions. 6 | # 7 | class archlinux_workstation::sudo { 8 | 9 | if ! defined(Class['archlinux_workstation']) { 10 | fail('You must include the base archlinux_workstation class before using any subclasses') 11 | } 12 | 13 | # variable access 14 | include archlinux_workstation 15 | 16 | # Class content here 17 | # saz/sudo; this purges the current config 18 | class {'sudo': } 19 | 20 | sudo::conf {'defaults-env_keep': 21 | priority => 0, 22 | content => 'Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET QTDIR KDEDIR XDG_SESSION_COOKIE"' 23 | } 24 | 25 | sudo::conf {"${archlinux_workstation::username}-all": 26 | priority => 10, 27 | content => "${archlinux_workstation::username} ALL=(ALL) ALL", 28 | } 29 | 30 | if $::virtual == 'virtualbox' { 31 | notify {'adding vagrant to sudoers users, per $::virtual fact': } 32 | sudo::conf {'vagrant-all': 33 | priority => 11, 34 | content => 'vagrant ALL=(ALL) NOPASSWD: ALL', 35 | } 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /manifests/template.txt: -------------------------------------------------------------------------------- 1 | # == Class: archlinux_workstation::CLASSNAME 2 | # 3 | # Description of what the class does. 4 | # 5 | class archlinux_workstation::CLASSNAME { 6 | 7 | if ! defined(Class['archlinux_workstation']) { 8 | fail('You must include the base archlinux_workstation class before using any subclasses') 9 | } 10 | 11 | # variable access 12 | include archlinux_workstation 13 | 14 | # Class content here 15 | 16 | } 17 | -------------------------------------------------------------------------------- /manifests/userapps/rvm.pp: -------------------------------------------------------------------------------- 1 | # 2 | # Install [rvm](https://rvm.io/) for the specified user, in their 3 | # home directory. 4 | # 5 | # When RVM is installed, it specifies the option to *not* modify the user's 6 | # shell rc scripts. 7 | # 8 | # @param user User to install rvm for. 9 | # @param userhome Path to ``$user``'s home directory. Default: ``/home/${username}``. 10 | # 11 | define archlinux_workstation::userapps::rvm ( 12 | String $user = $title, 13 | Variant[String, Undef] $userhome = undef, 14 | ) { 15 | 16 | if ! $userhome { 17 | $realhome = "/home/${user}" 18 | } else { 19 | $realhome = $userhome 20 | } 21 | 22 | # /etc/gemrc is put in place by the Pacman 'ruby' package, and sets 23 | # ``gem: --user-install`` 24 | # "--user-install is used to install to $HOME/.gem/ by default since we want 25 | # to separate pacman installed gems and gem installed gems" 26 | # this causes a problem with RVM, and also is unexpected behavior 27 | if ! defined(File['/etc/gemrc']) { 28 | file {'/etc/gemrc': 29 | ensure => absent, 30 | } 31 | } 32 | 33 | exec {"rvm-install-${user}": 34 | command => 'curl -sSL https://get.rvm.io | bash -s -- --ignore-dotfiles', 35 | creates => "${realhome}/.rvm/bin/rvm", 36 | user => $user, 37 | cwd => $realhome, 38 | path => '/usr/bin:/bin', 39 | environment => "HOME=${realhome}", 40 | require => File['/etc/gemrc'], 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /manifests/userapps/virtualbox.pp: -------------------------------------------------------------------------------- 1 | # 2 | # Install and configure VirtualBox, host DKMS, guest ISO and Oracle extensions. 3 | # Setup kernel module loading. Add ``$archlinux_workstation::username`` to 4 | # the ``vboxusers`` group. 5 | # 6 | class archlinux_workstation::userapps::virtualbox { 7 | 8 | if ! defined(Class['archlinux_workstation']) { 9 | fail('You must include the base archlinux_workstation class before using any subclasses') 10 | } 11 | 12 | include archlinux_workstation 13 | 14 | $packages = [ 15 | 'virtualbox', 16 | 'virtualbox-host-dkms', 17 | 'virtualbox-guest-iso', 18 | 'virtualbox-ext-oracle', # AUR package 19 | ] 20 | 21 | package {$packages: 22 | ensure => present, 23 | } 24 | 25 | file {'/etc/modules-load.d/virtualbox.conf': 26 | ensure => present, 27 | owner => 'root', 28 | group => 'root', 29 | mode => '0644', 30 | content => "# managed by puppet module ${module_name}\nvboxdrv\nvboxnetadp\nvboxnetflt\nvboxpci", 31 | } 32 | 33 | # add the user defined in init.pp to vboxusers group with plusignment 34 | User<| title == $archlinux_workstation::username |> { 35 | groups +> ['vboxusers'], 36 | require +> [ Package['virtualbox'] ], 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /manifests/xorg.pp: -------------------------------------------------------------------------------- 1 | # 2 | # Install packages required for [Xorg](https://wiki.archlinux.org/index.php/Xorg) 3 | # X server, as well as some additional packages. 4 | # 5 | # **Note** - @TODO - currently this just installs the default "xf86-video-vesa" driver. 6 | # Need to write a fact to find video cards and choose the correct driver, 7 | # per [Driver Installation](https://wiki.archlinux.org/index.php/Xorg#Driver_installation), 8 | # or expose this option to the user. 9 | # 10 | class archlinux_workstation::xorg { 11 | 12 | if ! defined(Class['archlinux_workstation']) { 13 | fail('You must include the base archlinux_workstation class before using any subclasses') 14 | } 15 | 16 | $xorg_packages = ['xorg-server', 17 | 'xorg-apps', 18 | 'xorg-xinit', 19 | 'mesa', 20 | 'xf86-video-vesa', 21 | # we need xterm for 'startx' 22 | 'xterm'] 23 | 24 | package {$xorg_packages: 25 | ensure => present, 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jantman-archlinux_workstation", 3 | "version": "0.5.1", 4 | "summary": "Configure an Arch Linux workstation/desktop/laptop", 5 | "author": "jantman", 6 | "description": "Provides many classes (and a sane default class/init.pp) for configuring an Arch Linux workstation/laptop/desktop for graphical use.", 7 | "dependencies": [ 8 | { 9 | "name": "puppetlabs/stdlib", 10 | "version_requirement": ">=4.1.0 <4.13.0" 11 | }, 12 | { 13 | "name": "saz/sudo", 14 | "version_requirement": ">=4.2.0 <5.0.0" 15 | }, 16 | { 17 | "name": "saz/ssh", 18 | "version_requirement": "3.0.1" 19 | }, 20 | { 21 | "name": "puppetlabs/concat", 22 | "version_requirement": ">= 1.2.5" 23 | }, 24 | { 25 | "name": "puppetlabs/inifile", 26 | "version_requirement": ">= 1.0.0 <3.0.0" 27 | }, 28 | { 29 | "name": "nanliu/staging", 30 | "version_requirement": ">= 1.0.0 <2.0.0" 31 | }, 32 | { 33 | "name": "puppetlabs/firewall", 34 | "version_requirement": ">= 1.0.0 <2.0.0" 35 | }, 36 | { 37 | "name": "garethr/docker", 38 | "version_requirement": ">= 5.0.0 <6.0.0" 39 | } 40 | ], 41 | "operatingsystem_support": [ 42 | { 43 | "operatingsystem": "Archlinux" 44 | } 45 | ], 46 | "requirements": [ 47 | { 48 | "name": "puppet", 49 | "version_requirement": ">= 4.0.0 < 6.0.0" 50 | } 51 | ], 52 | "checksums": { 53 | }, 54 | "source": "https://github.com/jantman/puppet-archlinux-workstation", 55 | "project_page": "https://github.com/jantman/puppet-archlinux-workstation", 56 | "license": "GPL-3.0" 57 | } 58 | -------------------------------------------------------------------------------- /spec/acceptance/classes/0_init_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'archlinux_workstation class' do 4 | 5 | context 'default parameters' do 6 | # Using puppet_apply as a helper 7 | it 'should work with no errors' do 8 | pp = <<-EOS 9 | class { 'archlinux_workstation': username => 'myuser',} 10 | EOS 11 | 12 | # Run it twice and test for idempotency 13 | apply_manifest(pp, :catch_failures => true) 14 | expect(apply_manifest(pp, :catch_changes => true).exit_code).to eq(0) 15 | end 16 | 17 | describe user('myuser') do 18 | it { should exist } 19 | it { should belong_to_group 'myuser' } 20 | it { should belong_to_group 'sys' } 21 | it { should have_home_directory '/home/myuser' } 22 | it { should have_login_shell '/bin/bash' } 23 | end 24 | 25 | describe group('myuser') do 26 | it { should exist } 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /spec/acceptance/classes/1_xorg_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'archlinux_workstation::xorg class' do 4 | 5 | context 'default parameters' do 6 | # Using puppet_apply as a helper 7 | it 'should work with no errors' do 8 | pp = <<-EOS 9 | class { 'archlinux_workstation': username => 'myuser',} 10 | class { 'archlinux_workstation::xorg': } 11 | EOS 12 | 13 | # Run it twice and test for idempotency 14 | apply_manifest(pp, :catch_failures => true) 15 | expect(apply_manifest(pp, :catch_changes => true).exit_code).to eq(0) 16 | end 17 | 18 | packages = [ 19 | 'xorg-server', 20 | 'xorg-xinit', 21 | 'mesa', 22 | 'xf86-video-vesa', 23 | 'xterm', 24 | # xorg-apps is a package group 25 | 'xorg-xauth', 26 | 'xorg-xrandr', 27 | 'xorg-xwd', 28 | ] 29 | 30 | packages.each do |pkgname| 31 | describe package(pkgname) do 32 | it { should be_installed } 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /spec/acceptance/classes/base_packages_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'archlinux_workstation::base_packages class' do 4 | 5 | context 'default parameters' do 6 | # Using puppet_apply as a helper 7 | it 'should work with no errors' do 8 | pp = <<-EOS 9 | class { 'archlinux_workstation': username => 'myuser',} -> 10 | class { 'archlinux_workstation::base_packages': } 11 | EOS 12 | 13 | # Run it twice and test for idempotency 14 | apply_manifest(pp, :catch_failures => true) 15 | expect(apply_manifest(pp, :catch_changes => true).exit_code).to eq(0) 16 | end 17 | 18 | packages_absent = [ 19 | 'lynx', 20 | ] 21 | 22 | packages_present = [ 23 | 'bind', 24 | 'dmidecode', 25 | 'dialog', 26 | 'links', 27 | 'lsb-release', 28 | 'lsof', 29 | 'lsscsi', 30 | 'net-tools', 31 | 'screen', 32 | 'ttf-dejavu', 33 | 'vim', 34 | 'wget', 35 | ] 36 | 37 | packages_present.each do |pkgname| 38 | describe package(pkgname) do 39 | it { should be_installed } 40 | end 41 | end 42 | 43 | packages_absent.each do |pkgname| 44 | describe package(pkgname) do 45 | it { should_not be_installed } 46 | end 47 | end 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /spec/acceptance/classes/chrony_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'archlinux_workstation::chrony class' do 4 | 5 | context 'default parameters' do 6 | # Using puppet_apply as a helper 7 | it 'should work with no errors' do 8 | pp = <<-EOS 9 | class { 'archlinux_workstation': username => 'myuser',} 10 | class { 'archlinux_workstation::repos::jantman': } 11 | class { 'archlinux_workstation::chrony': } 12 | EOS 13 | 14 | # Run it twice and test for idempotency 15 | apply_manifest(pp, :catch_failures => true) 16 | expect(apply_manifest(pp, :catch_changes => true).exit_code).to eq(0) 17 | end 18 | 19 | describe package('chrony') do 20 | it { should be_installed } 21 | end 22 | 23 | describe package('networkmanager-dispatcher-chrony') do 24 | it { should be_installed } 25 | end 26 | 27 | describe file('/etc/chrony.conf') do 28 | it { should be_file } 29 | it { should be_owned_by 'root' } 30 | it { should be_grouped_into 'root' } 31 | it { should be_mode 644 } 32 | # md5sum of files/chrony.conf 33 | its(:md5sum) { should eq '48dc41c1eea10d438e2fab124e1eaa7d' } 34 | end 35 | 36 | describe file('/etc/chrony.keys') do 37 | it { should be_file } 38 | it { should be_owned_by 'root' } 39 | it { should be_grouped_into 'root' } 40 | it { should be_mode 640 } 41 | its(:content) { should match /1 d83ja72\.f83,8wHUW94/ } 42 | end 43 | 44 | describe service('chronyd') do 45 | it { should be_enabled } 46 | it { should be_running } 47 | end 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /spec/acceptance/classes/cronie_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'archlinux_workstation::cronie class' do 4 | 5 | context 'default parameters' do 6 | # Using puppet_apply as a helper 7 | it 'should work with no errors' do 8 | pp = <<-EOS 9 | class { 'archlinux_workstation': username => 'myuser',} 10 | class { 'archlinux_workstation::cronie': } 11 | EOS 12 | 13 | # Run it twice and test for idempotency 14 | apply_manifest(pp, :catch_failures => true) 15 | expect(apply_manifest(pp, :catch_changes => true).exit_code).to eq(0) 16 | end 17 | 18 | describe package('cronie') do 19 | it { should be_installed } 20 | end 21 | 22 | describe service('cronie') do 23 | it { should be_enabled } 24 | it { should be_running } 25 | end 26 | 27 | describe file('/usr/lib/systemd/system/cronie.service.d') do 28 | it { should_not exist } 29 | end 30 | 31 | describe file('/usr/lib/systemd/system/cronie.service.d/cronie_mail_command.conf') do 32 | it { should_not exist } 33 | end 34 | end 35 | 36 | context 'mail_command specified' do 37 | # Using puppet_apply as a helper 38 | it 'should work with no errors' do 39 | pp = <<-EOS 40 | class { 'archlinux_workstation': username => 'myuser',} 41 | class { 'archlinux_workstation::cronie': mail_command => '/foo/bar/baz', } 42 | EOS 43 | 44 | # Run it twice and test for idempotency 45 | apply_manifest(pp, :catch_failures => true) 46 | expect(apply_manifest(pp, :catch_changes => true).exit_code).to eq(0) 47 | end 48 | 49 | describe package('cronie') do 50 | it { should be_installed } 51 | end 52 | 53 | describe service('cronie') do 54 | it { should be_enabled } 55 | it { should be_running } 56 | end 57 | 58 | describe file('/usr/lib/systemd/system/cronie.service.d') do 59 | it { should be_directory } 60 | it { should be_owned_by 'root' } 61 | it { should be_grouped_into 'root' } 62 | it { should be_mode 755 } 63 | end 64 | 65 | describe file('/usr/lib/systemd/system/cronie.service.d/cronie_mail_command.conf') do 66 | it { should be_file } 67 | it { should be_owned_by 'root' } 68 | it { should be_grouped_into 'root' } 69 | it { should be_mode 644 } 70 | its(:content) { should eq "# Managed by Puppet - archlinux_workstation::cronie class\n[Service]\nExecStart=\nExecStart=/usr/bin/crond -n -m /foo/bar/baz\n" } 71 | end 72 | 73 | describe process('crond') do 74 | it { should be_running } 75 | its(:args) { should match %r"-n -m /foo/bar/baz" } 76 | end 77 | end 78 | end 79 | -------------------------------------------------------------------------------- /spec/acceptance/classes/cups_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'archlinux_workstation::cups class' do 4 | 5 | context 'default parameters' do 6 | # Using puppet_apply as a helper 7 | it 'should work with no errors' do 8 | pp = <<-EOS 9 | class { 'archlinux_workstation': username => 'myuser',} 10 | class { 'archlinux_workstation::cups': } 11 | EOS 12 | 13 | # Run it twice and test for idempotency 14 | apply_manifest(pp, :catch_failures => true) 15 | expect(apply_manifest(pp, :catch_changes => true).exit_code).to eq(0) 16 | end 17 | 18 | cups_packages = [ 19 | 'cups', 20 | 'cups-filters', 21 | 'cups-pdf', 22 | 'ghostscript', 23 | 'gsfonts', 24 | 'gutenprint', 25 | 'libcups', 26 | ] 27 | 28 | cups_packages.each do |pkgname| 29 | describe package(pkgname) do 30 | it { should be_installed } 31 | end 32 | end 33 | 34 | describe service('cups') do 35 | it { should be_enabled } 36 | it { should be_running } 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /spec/acceptance/classes/dkms_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'archlinux_workstation::dkms class' do 4 | 5 | context 'default parameters' do 6 | # Using puppet_apply as a helper 7 | it 'should work with no errors' do 8 | pp = <<-EOS 9 | class { 'archlinux_workstation': username => 'myuser',} 10 | class { 'archlinux_workstation::dkms': } 11 | EOS 12 | 13 | # Run it twice and test for idempotency 14 | apply_manifest(pp, :catch_failures => true) 15 | expect(apply_manifest(pp, :catch_changes => true).exit_code).to eq(0) 16 | end 17 | 18 | describe package('dkms') do 19 | it { should be_installed } 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /spec/acceptance/classes/docker_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'archlinux_workstation::docker class' do 4 | 5 | context 'default parameters' do 6 | # Using puppet_apply as a helper 7 | it 'should work with no errors' do 8 | pp = <<-EOS 9 | class { 'archlinux_workstation': username => 'myuser',} 10 | class { 'archlinux_workstation::docker': 11 | service_state => 'stopped', 12 | } 13 | EOS 14 | 15 | # Run it twice and test for idempotency 16 | apply_manifest(pp, :catch_failures => true) 17 | expect(apply_manifest(pp, :catch_changes => true).exit_code).to eq(0) 18 | end 19 | 20 | describe package('docker') do 21 | it { should be_installed } 22 | end 23 | 24 | # we need to wait a bit before these processes are running 25 | describe command('sleep 10') do 26 | its(:exit_status) { should eq 0 } 27 | end 28 | 29 | describe service('docker') do 30 | it { should be_enabled } 31 | it { should_not be_running } 32 | end 33 | 34 | describe user('myuser') do 35 | it { should belong_to_group 'docker' } 36 | end 37 | 38 | describe command('docker info') do 39 | its(:exit_status) { should eq 1 } 40 | its(:stderr) { 41 | should contain('Cannot connect to the Docker daemon at unix:///var/run/docker.sock') 42 | } 43 | end 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /spec/acceptance/classes/kde_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'archlinux_workstation::kde class' do 4 | 5 | context 'default parameters' do 6 | # Using puppet_apply as a helper 7 | it 'should work with no errors' do 8 | pp = <<-EOS 9 | class { 'archlinux_workstation': username => 'myuser',} 10 | class { 'archlinux_workstation::kde': } 11 | EOS 12 | 13 | # Run it twice and test for idempotency 14 | apply_manifest(pp, :catch_failures => true) 15 | expect(apply_manifest(pp, :catch_changes => true).exit_code).to eq(0) 16 | end 17 | 18 | describe package('plasma-meta') do 19 | it { should be_installed } 20 | end 21 | 22 | describe package('kde-applications-meta') do 23 | it { should be_installed } 24 | end 25 | 26 | $phonon_packages = [ 27 | 'phonon-qt5', 28 | 'phonon-qt5-gstreamer', 29 | 'phonon-qt5-vlc', 30 | ] 31 | 32 | $phonon_packages.each do |pkgname| 33 | describe package(pkgname) do 34 | it { should be_installed } 35 | end 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /spec/acceptance/classes/makepkg_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'archlinux_workstation::makepkg class' do 4 | 5 | context 'default parameters' do 6 | # Using puppet_apply as a helper 7 | it 'should work with no errors' do 8 | pp = <<-EOS 9 | class { 'archlinux_workstation': username => 'myuser',} 10 | class { 'archlinux_workstation::makepkg': make_flags => '-j4',} 11 | EOS 12 | 13 | # Run it twice and test for idempotency 14 | apply_manifest(pp, :catch_failures => true) 15 | expect(apply_manifest(pp, :catch_changes => true).exit_code).to eq(0) 16 | end 17 | 18 | describe file('/etc/makepkg.conf') do 19 | it { should be_file } 20 | it { should be_owned_by 'root' } 21 | it { should be_grouped_into 'root' } 22 | it { should be_mode 644 } 23 | its(:content) { should match /MAKEFLAGS="-j4"/ } 24 | its(:content) { should match /CFLAGS="-march=native -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"/ } 25 | its(:content) { should match /CXXFLAGS="-march=native -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"/ } 26 | its(:content) { should match /BUILDENV=\(fakeroot !distcc color !ccache check !sign\)/ } 27 | its(:content) { should match %r"BUILDDIR=/tmp/makepkg" } 28 | its(:content) { should match %r"SRCDEST=/tmp/sources" } 29 | its(:content) { should match %r"LOGDEST=/tmp/makepkglogs" } 30 | end 31 | 32 | describe file('/tmp/sources') do 33 | it { should be_directory } 34 | it { should be_owned_by 'myuser' } 35 | it { should be_mode 775 } 36 | end 37 | 38 | describe file('/tmp/makepkg') do 39 | it { should be_directory } 40 | it { should be_owned_by 'myuser' } 41 | it { should be_mode 775 } 42 | end 43 | 44 | describe file('/tmp/makepkglogs') do 45 | it { should be_directory } 46 | it { should be_owned_by 'myuser' } 47 | it { should be_mode 775 } 48 | end 49 | 50 | describe file('/etc/tmpfiles.d/makepkg_puppet.conf') do 51 | it { should be_file } 52 | it { should be_owned_by 'root' } 53 | it { should be_grouped_into 'root' } 54 | it { should be_mode 644 } 55 | its(:content) { should eq "# managed by archlinux_workstation::makepkg puppet class\nD /tmp/sources 0775 myuser wheel\nD /tmp/makepkg 0775 myuser wheel\nD /tmp/makepkglogs 0775 myuser wheel" } 56 | end 57 | end 58 | 59 | context 'makepkg_packager specified' do 60 | # Using puppet_apply as a helper 61 | it 'should work with no errors' do 62 | pp = <<-EOS 63 | class { 'archlinux_workstation': username => 'myuser', makepkg_packager => 'Foo Bar ', } 64 | class { 'archlinux_workstation::makepkg': make_flags => '-j4',} 65 | EOS 66 | 67 | # Run it twice and test for idempotency 68 | apply_manifest(pp, :catch_failures => true) 69 | expect(apply_manifest(pp, :catch_changes => true).exit_code).to eq(0) 70 | end 71 | 72 | describe file('/etc/makepkg.conf') do 73 | it { should be_file } 74 | it { should be_owned_by 'root' } 75 | it { should be_grouped_into 'root' } 76 | it { should be_mode 644 } 77 | its(:content) { should match /MAKEFLAGS="-j4"/ } 78 | its(:content) { should match /^PACKAGER='Foo Bar '/ } 79 | its(:content) { should match /CFLAGS="-march=native -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"/ } 80 | its(:content) { should match /CXXFLAGS="-march=native -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"/ } 81 | its(:content) { should match /BUILDENV=\(fakeroot !distcc color !ccache check !sign\)/ } 82 | its(:content) { should match %r"BUILDDIR=/tmp/makepkg" } 83 | its(:content) { should match %r"SRCDEST=/tmp/sources" } 84 | its(:content) { should match %r"LOGDEST=/tmp/makepkglogs" } 85 | end 86 | 87 | describe file('/tmp/sources') do 88 | it { should be_directory } 89 | it { should be_owned_by 'myuser' } 90 | it { should be_mode 775 } 91 | end 92 | 93 | describe file('/tmp/makepkg') do 94 | it { should be_directory } 95 | it { should be_owned_by 'myuser' } 96 | it { should be_mode 775 } 97 | end 98 | 99 | describe file('/tmp/makepkglogs') do 100 | it { should be_directory } 101 | it { should be_owned_by 'myuser' } 102 | it { should be_mode 775 } 103 | end 104 | 105 | describe file('/etc/tmpfiles.d/makepkg_puppet.conf') do 106 | it { should be_file } 107 | it { should be_owned_by 'root' } 108 | it { should be_grouped_into 'root' } 109 | it { should be_mode 644 } 110 | its(:content) { should eq "# managed by archlinux_workstation::makepkg puppet class\nD /tmp/sources 0775 myuser wheel\nD /tmp/makepkg 0775 myuser wheel\nD /tmp/makepkglogs 0775 myuser wheel" } 111 | end 112 | end 113 | end 114 | -------------------------------------------------------------------------------- /spec/acceptance/classes/networkmanager_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'archlinux_workstation::networkmanager class' do 4 | 5 | context 'default parameters' do 6 | # Using puppet_apply as a helper 7 | it 'should work with no errors' do 8 | pp = <<-EOS 9 | class { 'archlinux_workstation': username => 'myuser',} 10 | class { 'archlinux_workstation::networkmanager': } 11 | EOS 12 | 13 | # Run it twice and test for idempotency 14 | apply_manifest(pp, :catch_failures => true) 15 | expect(apply_manifest(pp, :catch_changes => true).exit_code).to eq(0) 16 | end 17 | 18 | describe package('networkmanager') do 19 | it { should be_installed } 20 | end 21 | 22 | describe service('NetworkManager') do 23 | it { should be_enabled } 24 | it { should be_running } 25 | end 26 | 27 | describe service('dhcpcd@eth0') do 28 | it { should_not be_enabled } 29 | it { should_not be_running } 30 | end 31 | end 32 | context 'with kde' do 33 | # Using puppet_apply as a helper 34 | it 'should work with no errors' do 35 | pp = <<-EOS 36 | class { 'archlinux_workstation': username => 'myuser',} -> 37 | class { 'archlinux_workstation::kde': } -> 38 | class { 'archlinux_workstation::networkmanager': } 39 | EOS 40 | 41 | # Run it twice and test for idempotency 42 | apply_manifest(pp, :catch_failures => true) 43 | expect(apply_manifest(pp, :catch_changes => true).exit_code).to eq(0) 44 | end 45 | 46 | describe package('networkmanager') do 47 | it { should be_installed } 48 | end 49 | 50 | describe service('NetworkManager') do 51 | it { should be_enabled } 52 | it { should be_running } 53 | end 54 | 55 | describe service('dhcpcd@eth0') do 56 | it { should_not be_enabled } 57 | it { should_not be_running } 58 | end 59 | 60 | describe package('plasma-nm') do 61 | it { should be_installed } 62 | end 63 | end 64 | end 65 | -------------------------------------------------------------------------------- /spec/acceptance/classes/repos/jantman_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'archlinux_workstation::repos::jantman class' do 4 | 5 | context 'default parameters' do 6 | # Using puppet_apply as a helper 7 | it 'should work with no errors' do 8 | pp = <<-EOS 9 | class { 'archlinux_workstation': username => 'myuser',} 10 | class { 'archlinux_workstation::repos::jantman': } 11 | EOS 12 | 13 | # Run it twice and test for idempotency 14 | apply_manifest(pp, :catch_failures => true) 15 | expect(apply_manifest(pp, :catch_changes => true).exit_code).to eq(0) 16 | end 17 | 18 | describe file('/etc/pacman.conf') do 19 | it { should be_file } 20 | its(:content) { should match /\[jantman\]\nSigLevel = Optional TrustedOnly\nServer = http:\/\/archrepo\.jasonantman\.com\/current/m } 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /spec/acceptance/classes/repos/multilib_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'archlinux_workstation::repos::multilib class' do 4 | 5 | context 'default parameters' do 6 | # Using puppet_apply as a helper 7 | it 'should work with no errors' do 8 | pp = <<-EOS 9 | class { 'archlinux_workstation': username => 'myuser',} 10 | class { 'archlinux_workstation::repos::multilib': } 11 | EOS 12 | 13 | # Run it twice and test for idempotency 14 | apply_manifest(pp, :catch_failures => true) 15 | expect(apply_manifest(pp, :catch_changes => true).exit_code).to eq(0) 16 | end 17 | 18 | describe file('/etc/pacman.conf') do 19 | it { should be_file } 20 | its(:content) { should match /\[multilib\]\nInclude = \/etc\/pacman\.d\/mirrorlist/m } 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /spec/acceptance/classes/sddm_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'archlinux_workstation::sddm class' do 4 | 5 | context 'default parameters' do 6 | # Using puppet_apply as a helper 7 | it 'should work with no errors' do 8 | pp = <<-EOS 9 | class { 'archlinux_workstation': username => 'myuser',} 10 | class { 'archlinux_workstation::sddm': service_ensure => 'stopped', } 11 | EOS 12 | 13 | # Run it twice and test for idempotency 14 | apply_manifest(pp, :catch_failures => true) 15 | # SDDM won't run properly in VirtualBox? 16 | expect(apply_manifest(pp, :catch_failures => true).exit_code).to eq(0).or(eq(2)) 17 | end 18 | 19 | describe package('sddm') do 20 | it { should be_installed } 21 | end 22 | 23 | describe service('sddm') do 24 | it { should be_enabled } 25 | it { should_not be_running } 26 | end 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /spec/acceptance/classes/ssh_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'archlinux_workstation::ssh class' do 4 | 5 | context 'default parameters' do 6 | # Using puppet_apply as a helper 7 | it 'should work with no errors' do 8 | pp = <<-EOS 9 | class { 'archlinux_workstation': username => 'myuser',} 10 | class { 'archlinux_workstation::ssh': permit_root => true, } 11 | EOS 12 | 13 | # Run it twice and test for idempotency 14 | apply_manifest(pp, :catch_failures => true) 15 | expect(apply_manifest(pp, :catch_failures => true).exit_code).to eq(0) 16 | end 17 | 18 | describe package('openssh') do 19 | it { should be_installed } 20 | end 21 | 22 | describe service('sshd') do 23 | it { should be_enabled } 24 | it { should be_running } 25 | end 26 | 27 | describe port(22) do 28 | it { should be_listening.on('0.0.0.0').with('tcp') } 29 | end 30 | 31 | describe file('/etc/ssh/sshd_config') do 32 | it { should be_file } 33 | its(:content) { should match /AllowUsers myuser/ } 34 | its(:content) { should match /AllowUsers root/ } 35 | its(:content) { should match /GSSAPIAuthentication no/ } 36 | its(:content) { should match /KerberosAuthentication no/ } 37 | its(:content) { should match /PasswordAuthentication no/ } 38 | its(:content) { should match /PermitRootLogin yes/ } 39 | its(:content) { should match /PubkeyAuthentication yes/ } 40 | its(:content) { should match /X11Forwarding yes/ } 41 | end 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /spec/acceptance/classes/sudo_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'archlinux_workstation::sudo class' do 4 | 5 | context 'default parameters' do 6 | # Using puppet_apply as a helper 7 | it 'should work with no errors' do 8 | pp = <<-EOS 9 | class { 'archlinux_workstation': username => 'myuser',} 10 | class { 'archlinux_workstation::sudo': } 11 | EOS 12 | 13 | # Run it twice and test for idempotency 14 | apply_manifest(pp, :catch_failures => true) 15 | expect(apply_manifest(pp, :catch_failures => true).exit_code).to eq(0) 16 | end 17 | 18 | describe package('sudo') do 19 | it { should be_installed } 20 | end 21 | 22 | describe file('/etc/sudoers.d/10_myuser-all') do 23 | its(:content) { should match /myuser ALL=\(ALL\) ALL/ } 24 | end 25 | 26 | describe file('/etc/sudoers.d/00_defaults-env_keep') do 27 | its(:content) { should match /Defaults env_keep \+= "LANG LANGUAGE LINGUAS LC_\* _XKB_CHARSET QTDIR KDEDIR XDG_SESSION_COOKIE"/ } 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /spec/acceptance/classes/userapps/rvm_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'archlinux_workstation::userapps::rvm class' do 4 | 5 | context 'default parameters' do 6 | # Using puppet_apply as a helper 7 | it 'should work with no errors' do 8 | pp = <<-EOS 9 | class { 'archlinux_workstation': username => 'myuser',} 10 | archlinux_workstation::userapps::rvm {'myuser': } 11 | EOS 12 | 13 | # Run it twice and test for idempotency 14 | apply_manifest(pp, :catch_failures => true) 15 | expect(apply_manifest(pp, :catch_changes => true).exit_code).to eq(0) 16 | end 17 | 18 | describe file('/etc/gemrc') do 19 | it { should_not exist } 20 | end 21 | 22 | describe file('/home/myuser/.rvm') do 23 | it { should be_directory } 24 | it { should be_owned_by 'myuser' } 25 | end 26 | 27 | describe file('/home/myuser/.rvm/bin/rvm') do 28 | it { should be_file } 29 | it { should be_executable } 30 | it { should be_owned_by 'myuser' } 31 | end 32 | 33 | describe command('sudo -Hi -u myuser /tmp/test_rvm.sh') do 34 | its(:exit_status) { should eq 0 } 35 | its(:stdout) { should contain('rvm rubies') } 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /spec/acceptance/classes/userapps/virtualbox_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'archlinux_workstation::userapps::virtualbox class' do 4 | 5 | context 'default parameters' do 6 | # Using puppet_apply as a helper 7 | it 'should work with no errors' do 8 | pp = <<-EOS 9 | class { 'archlinux_workstation': username => 'myuser',} 10 | class {'archlinux_workstation::userapps::virtualbox': } 11 | EOS 12 | 13 | # Run it twice and test for idempotency 14 | apply_manifest(pp, :catch_failures => true) 15 | expect(apply_manifest(pp, :catch_changes => true).exit_code).to eq(0) 16 | end 17 | 18 | packages = [ 19 | 'virtualbox', 20 | 'virtualbox-host-dkms', 21 | 'virtualbox-guest-iso', 22 | 'virtualbox-ext-oracle', 23 | ] 24 | 25 | packages.each do |pkgname| 26 | describe package(pkgname) do 27 | it { should be_installed } 28 | end 29 | end 30 | 31 | describe file('/etc/modules-load.d/virtualbox.conf') do 32 | it { should be_file } 33 | it { should be_owned_by 'root' } 34 | it { should be_grouped_into 'root' } 35 | it { should be_mode 644 } 36 | its(:content) { should eq "# managed by puppet module archlinux_workstation\nvboxdrv\nvboxnetadp\nvboxnetflt\nvboxpci" } 37 | end 38 | 39 | describe user('myuser') do 40 | it { should exist } 41 | it { should belong_to_group 'myuser' } 42 | it { should belong_to_group 'sys' } 43 | it { should belong_to_group 'vboxusers' } 44 | it { should have_home_directory '/home/myuser' } 45 | it { should have_login_shell '/bin/bash' } 46 | end 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/default.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | archlinux-current-x64: 3 | platform: archlinux-current-amd64 4 | hypervisor: docker 5 | image: archlinux/base:latest 6 | docker_preserve_image: true 7 | docker_cmd: '["/usr/lib/systemd/systemd"]' 8 | docker_cap_add: ['SYS_ADMIN'] 9 | mount_folders: 10 | cgroup: 11 | host_path: /sys/fs/cgroup 12 | container_path: /sys/fs/cgroup 13 | opts: ro 14 | docker_image_commands: 15 | - 'echo "en_US.UTF-8 UTF-8" > /etc/locale.gen' 16 | - 'pacman -S --noconfirm grep tar which awk' 17 | CONFIG: 18 | trace_limit: 200 19 | -------------------------------------------------------------------------------- /spec/classes/all_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'archlinux_workstation::all' do 4 | let(:facts) { spec_facts } 5 | 6 | context 'parent class' do 7 | context 'without archlinux_workstation defined' do 8 | describe "raises error" do 9 | it { expect { should contain_class('archlinux_workstation::all') }.to raise_error(Puppet::Error, /You must include the base/) } 10 | end 11 | end 12 | 13 | context 'with archlinux_workstation defined' do 14 | describe 'compiles correctly' do 15 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 16 | 17 | it { should compile.with_all_deps } 18 | 19 | it { should contain_class('archlinux_workstation') } 20 | it { should contain_class('archlinux_workstation::all') } 21 | end 22 | end 23 | end # end context 'parent class' 24 | 25 | context 'child classes' do 26 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 27 | describe 'classes included in all' do 28 | it { should contain_class('archlinux_workstation::repos::jantman') } 29 | it { should contain_class('archlinux_workstation::repos::multilib') } 30 | it { should contain_class('archlinux_workstation::base_packages') } 31 | it { should contain_class('archlinux_workstation::chrony') } 32 | it { should contain_class('archlinux_workstation::cronie') } 33 | it { should contain_class('archlinux_workstation::cups') } 34 | it { should contain_class('archlinux_workstation::dkms') } 35 | it { should contain_class('archlinux_workstation::docker') } 36 | it { should contain_class('archlinux_workstation::makepkg') } 37 | it { should contain_class('archlinux_workstation::networkmanager') } 38 | it { should contain_class('archlinux_workstation::ssh') } 39 | it { should contain_class('archlinux_workstation::sudo') } 40 | it { should contain_class('archlinux_workstation::xorg').that_comes_before('Class[archlinux_workstation::kde]') } 41 | it { should contain_class('archlinux_workstation::kde').that_comes_before('Class[archlinux_workstation::sddm]') } 42 | it { should contain_class('archlinux_workstation::sddm') } 43 | 44 | it { should contain_archlinux_workstation__userapps__rvm('myuser') } 45 | it { should contain_exec('rvm-install-myuser') } 46 | it { should contain_class('archlinux_workstation::userapps::virtualbox') } 47 | it { should contain_group('myuser') } 48 | end 49 | end 50 | 51 | end 52 | -------------------------------------------------------------------------------- /spec/classes/base_packages_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'archlinux_workstation::base_packages' do 4 | let(:facts) { spec_facts } 5 | 6 | context 'parent class' do 7 | context 'without archlinux_workstation defined' do 8 | describe "raises error" do 9 | it { expect { should contain_class('archlinux_workstation::base_packages') }.to raise_error(Puppet::Error, /You must include the base/) } 10 | end 11 | end 12 | 13 | context 'with archlinux_workstation defined' do 14 | describe 'compiles correctly' do 15 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 16 | 17 | it { should compile.with_all_deps } 18 | 19 | it { should contain_class('archlinux_workstation') } 20 | it { should contain_class('archlinux_workstation::base_packages') } 21 | end 22 | end 23 | end # end context 'parent class' 24 | 25 | context 'ensure present packages' do 26 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 27 | 28 | it { should compile.with_all_deps } 29 | 30 | packages = ['links', 31 | 'lsb-release', 32 | 'dmidecode', 33 | 'dialog', 34 | 'vim', 35 | 'ttf-dejavu', 36 | 'wget', 37 | 'bind', 38 | 'net-tools', 39 | 'lsof', 40 | 'screen', 41 | 'lsscsi' 42 | ] 43 | 44 | packages.each do |package| 45 | describe "package #{package}" do 46 | it { should contain_package(package).with_ensure('present') } 47 | end 48 | end 49 | 50 | end 51 | 52 | context 'ensure absent packages' do 53 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 54 | 55 | it { should compile.with_all_deps } 56 | 57 | packages_absent = ['lynx', 58 | ] 59 | 60 | packages_absent.each do |package| 61 | describe "package #{package}" do 62 | it { should contain_package(package).with_ensure('absent') } 63 | end 64 | end 65 | end 66 | 67 | end 68 | -------------------------------------------------------------------------------- /spec/classes/chrony_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'archlinux_workstation::chrony' do 4 | let(:facts) { spec_facts } 5 | 6 | context 'parent class' do 7 | context 'without archlinux_workstation defined' do 8 | describe "raises error" do 9 | it { expect { should contain_class('archlinux_workstation::chrony') }.to raise_error(Puppet::Error, /You must include the base/) } 10 | end 11 | end 12 | 13 | context 'with archlinux_workstation defined' do 14 | describe 'compiles correctly' do 15 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' } -> class {'archlinux_workstation::repos::jantman': }" } 16 | 17 | it { should compile.with_all_deps } 18 | 19 | it { should contain_class('archlinux_workstation') } 20 | it { should contain_class('archlinux_workstation::chrony') } 21 | end 22 | end 23 | end # end context 'parent class' 24 | 25 | context 'parameters' do 26 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' } -> class {'archlinux_workstation::repos::jantman': }" } 27 | 28 | describe "default" do 29 | let(:params) {{ }} 30 | 31 | it { should compile.with_all_deps } 32 | 33 | it { should contain_package('chrony').with({ 'ensure' => 'present' }) } 34 | it { should contain_package('networkmanager-dispatcher-chrony') 35 | .with({ 'ensure' => 'present' }) 36 | .that_requires('Class[archlinux_workstation::repos::jantman]') 37 | } 38 | it { should contain_service('chronyd').with({ 39 | 'enable' => true, 40 | 'ensure' => 'running', 41 | }) } 42 | 43 | it { should contain_file('/etc/chrony.keys').with({ 44 | 'ensure' => 'present', 45 | 'owner' => 'root', 46 | 'group' => 'root', 47 | 'mode' => '0640', 48 | }) \ 49 | .that_requires('Package[chrony]') \ 50 | .that_notifies('Service[chronyd]') \ 51 | .with_content('1 d83ja72.f83,8wHUW94') 52 | } 53 | 54 | it { should contain_file('/etc/chrony.conf').with({ 55 | 'ensure' => 'present', 56 | 'owner' => 'root', 57 | 'group' => 'root', 58 | 'mode' => '0644', 59 | }) \ 60 | .that_requires('Package[chrony]') \ 61 | .that_notifies('Service[chronyd]') \ 62 | .with_source('puppet:///modules/archlinux_workstation/chrony.conf') 63 | } 64 | 65 | end 66 | 67 | describe "password specified" do 68 | let(:params) {{ 69 | 'chrony_password' => 'foobarbaz', 70 | }} 71 | 72 | it { should compile.with_all_deps } 73 | 74 | it { should contain_file('/etc/chrony.keys').with_content('1 foobarbaz') } 75 | end 76 | end 77 | 78 | end 79 | -------------------------------------------------------------------------------- /spec/classes/coverage_spec.rb: -------------------------------------------------------------------------------- 1 | at_exit { RSpec::Puppet::Coverage.report! } 2 | -------------------------------------------------------------------------------- /spec/classes/cronie_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'archlinux_workstation::cronie' do 4 | let(:facts) { spec_facts } 5 | 6 | context 'parent class' do 7 | context 'without archlinux_workstation defined' do 8 | describe "raises error" do 9 | it { expect { should contain_class('archlinux_workstation::chrony') }.to raise_error(Puppet::Error, /You must include the base/) } 10 | end 11 | end 12 | 13 | context 'with archlinux_workstation defined' do 14 | describe 'compiles correctly' do 15 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 16 | 17 | it { should compile.with_all_deps } 18 | 19 | it { should contain_class('archlinux_workstation') } 20 | it { should contain_class('archlinux_workstation::cronie') } 21 | end 22 | end 23 | end # end context 'parent class' 24 | 25 | context 'parameters' do 26 | describe "default" do 27 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 28 | let(:params) {{ }} 29 | 30 | it { should compile.with_all_deps } 31 | 32 | it { should contain_package('cronie').with({ 'ensure' => 'present' }) } 33 | it { should contain_service('cronie').with({ 34 | 'enable' => true, 35 | 'ensure' => 'running', 36 | 'require' => ['Package[cronie]'], 37 | }) } 38 | it { should_not contain_exec('cronie-daemon-reload') } 39 | it { should_not contain_file('cronie.service.d') } 40 | it { should_not contain_file('cronie_mail_command.conf') } 41 | end 42 | describe "mail_command specified" do 43 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 44 | let(:params) {{ :mail_command => '/foo/bar/baz' }} 45 | 46 | it { should compile.with_all_deps } 47 | 48 | it { should contain_package('cronie').with({ 'ensure' => 'present' }) } 49 | it { should contain_exec('cronie-daemon-reload').with({ 50 | 'command' => '/usr/bin/systemctl daemon-reload', 51 | 'refreshonly' => true, 52 | }) 53 | } 54 | it { should contain_service('cronie').with({ 55 | 'enable' => true, 56 | 'ensure' => 'running', 57 | 'require' => ['Package[cronie]', 'File[cronie_mail_command.conf]', 'Exec[cronie-daemon-reload]'], 58 | }) } 59 | it { should contain_file('cronie.service.d').with({ 60 | 'ensure' => 'directory', 61 | 'path' => '/usr/lib/systemd/system/cronie.service.d', 62 | 'owner' => 'root', 63 | 'group' => 'root', 64 | 'mode' => '0755', 65 | 'require' => 'Package[cronie]', 66 | }) 67 | } 68 | 69 | $content = "# Managed by Puppet - archlinux_workstation::cronie class\n[Service]\nExecStart=\nExecStart=/usr/bin/crond -n -m /foo/bar/baz\n" 70 | 71 | it { should contain_file('cronie_mail_command.conf').with({ 72 | 'ensure' => 'present', 73 | 'path' => '/usr/lib/systemd/system/cronie.service.d/cronie_mail_command.conf', 74 | 'owner' => 'root', 75 | 'group' => 'root', 76 | 'mode' => '0644', 77 | 'require' => 'File[cronie.service.d]', 78 | 'content' => $content, 79 | }) 80 | } 81 | end 82 | end 83 | 84 | end 85 | -------------------------------------------------------------------------------- /spec/classes/cups_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'archlinux_workstation::cups' do 4 | context 'parameters' do 5 | let(:facts) { spec_facts } 6 | 7 | let(:params) {{ }} 8 | 9 | it { should compile.with_all_deps } 10 | 11 | cups_packages = [ 12 | 'cups', 13 | 'cups-filters', 14 | 'cups-pdf', 15 | 'ghostscript', 16 | 'gsfonts', 17 | 'gutenprint', 18 | 'libcups', 19 | ] 20 | 21 | cups_packages.each do |pkgname| 22 | describe "package #{pkgname}" do 23 | it { should contain_package(pkgname).with_ensure('present') } 24 | end 25 | end 26 | 27 | it { should contain_service('cups').with({ 28 | 'enable' => true, 29 | 'ensure' => 'running', 30 | }).that_requires('Package[cups]') } 31 | 32 | end 33 | 34 | end 35 | -------------------------------------------------------------------------------- /spec/classes/dkms_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'archlinux_workstation::dkms' do 4 | let(:facts) { spec_facts } 5 | 6 | context 'parent class' do 7 | context 'without archlinux_workstation defined' do 8 | describe "raises error" do 9 | it { expect { should contain_class('archlinux_workstation::chrony') }.to raise_error(Puppet::Error, /You must include the base/) } 10 | end 11 | end 12 | 13 | context 'with archlinux_workstation defined' do 14 | describe 'compiles correctly' do 15 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 16 | 17 | it { should compile.with_all_deps } 18 | 19 | it { should contain_class('archlinux_workstation') } 20 | it { should contain_class('archlinux_workstation::dkms') } 21 | end 22 | end 23 | end # end context 'parent class' 24 | 25 | context 'parameters' do 26 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 27 | describe "default" do 28 | let(:params) {{ }} 29 | 30 | it { should compile.with_all_deps } 31 | 32 | it { should contain_package('dkms') } 33 | end 34 | 35 | end 36 | 37 | end 38 | -------------------------------------------------------------------------------- /spec/classes/docker_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'archlinux_workstation::docker' do 4 | let(:facts) { spec_facts } 5 | 6 | context 'parent class' do 7 | context 'without archlinux_workstation defined' do 8 | describe "raises error" do 9 | it { expect { should contain_class('archlinux_workstation::docker') }.to raise_error(Puppet::Error, /You must include the base/) } 10 | end 11 | end 12 | 13 | context 'with archlinux_workstation defined' do 14 | describe 'compiles correctly' do 15 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 16 | 17 | it { should compile.with_all_deps } 18 | 19 | it { should contain_file('/etc/conf.d') 20 | .with({ 21 | :ensure => 'directory', 22 | :owner => 'root', 23 | :group => 'root', 24 | :mode => '0755' 25 | }) 26 | .that_comes_before('Class[docker]') 27 | } 28 | 29 | it { should contain_class('archlinux_workstation') } 30 | it { should contain_class('archlinux_workstation::docker') } 31 | end 32 | end 33 | end # end context 'parent class' 34 | context 'parameters' do 35 | let(:facts) { spec_facts } 36 | context 'default' do 37 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 38 | let(:params) {{ }} 39 | describe "docker_class" do 40 | it { should compile.with_all_deps } 41 | it { should contain_class('docker').with_service_state('running') } 42 | end 43 | describe 'virtual user has group added' do 44 | it { should compile.with_all_deps } 45 | it { should contain_user('myuser') 46 | .with_groups(['sys', 'docker']) 47 | .that_requires(['Group[myuser]', 'Class[docker]']) 48 | } 49 | end 50 | end 51 | context 'service_state stopped' do 52 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 53 | let(:params) {{ 'service_state' => 'stopped' }} 54 | describe "docker_class" do 55 | it { should compile.with_all_deps } 56 | it { should contain_class('docker').with_service_state('stopped') } 57 | end 58 | describe 'virtual user has group added' do 59 | it { should compile.with_all_deps } 60 | it { should contain_user('myuser') 61 | .with_groups(['sys', 'docker']) 62 | .that_requires(['Group[myuser]', 'Class[docker]']) 63 | } 64 | end 65 | end 66 | end 67 | 68 | end 69 | -------------------------------------------------------------------------------- /spec/classes/init_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'archlinux_workstation' do 4 | let(:facts) { spec_facts } 5 | 6 | context 'supported operating systems' do 7 | describe "archlinux_workstation class with username parameter on Archlinux" do 8 | let(:params) {{ 9 | 'username' => 'foouser', 10 | }} 11 | 12 | it { should compile.with_all_deps } 13 | 14 | it { should contain_class('archlinux_workstation') } 15 | end 16 | end 17 | 18 | context 'unsupported operating system' do 19 | describe 'archlinux_workstation class without any parameters on Solaris/Nexenta' do 20 | let(:facts) {{ 21 | :osfamily => 'Solaris', 22 | :operatingsystem => 'Nexenta', 23 | # structured facts 24 | :os => { 'family' => 'Solaris', 'name' => 'Nexenta', }, 25 | }} 26 | let(:params) {{ 27 | 'username' => 'foouser', 28 | }} 29 | 30 | it { expect { should contain_class('archlinux_workstation') }.to raise_error(Puppet::Error, /Nexenta not supported/) } 31 | end 32 | describe 'archlinux_workstation class without any parameters on CentOS' do 33 | let(:facts) {{ 34 | :osfamily => 'RedHat', 35 | :operatingsystem => 'CentOS', 36 | # structured facts 37 | :os => { 'family' => 'RedHat', 'name' => 'CentOS', }, 38 | }} 39 | let(:params) {{ 40 | 'username' => 'foouser', 41 | }} 42 | 43 | it { expect { should contain_class('archlinux_workstation') }.to raise_error(Puppet::Error, /CentOS not supported/) } 44 | end 45 | describe 'archlinux_workstation class without any parameters on Debian' do 46 | let(:facts) {{ 47 | :osfamily => 'Debian', 48 | :operatingsystem => 'debian', 49 | # structured facts 50 | :os => { 'family' => 'Debian', 'name' => 'debian', }, 51 | }} 52 | let(:params) {{ 53 | 'username' => 'foouser', 54 | }} 55 | 56 | it { expect { should contain_class('archlinux_workstation') }.to raise_error(Puppet::Error, /debian not supported/) } 57 | end 58 | end 59 | 60 | context 'parameters' do 61 | describe "username is undefined" do 62 | let(:params) {{ }} 63 | 64 | it { expect { should contain_class('archlinux_workstation') }.to raise_error(/parameter 'username' expects a String value, got Undef/) } 65 | end 66 | 67 | describe "username is defined" do 68 | let(:params) {{ 69 | 'username' => 'foouser', 70 | }} 71 | 72 | it { should compile.with_all_deps } 73 | end 74 | end # context 'parameters' 75 | 76 | context 'user management' do 77 | describe "default parameters" do 78 | let(:params) {{ 79 | 'username' => 'foouser', 80 | }} 81 | 82 | it { should compile.with_all_deps } 83 | 84 | it { should contain_user('foouser') 85 | .with({ 86 | 'name' => 'foouser', 87 | 'ensure' => 'present', 88 | 'comment' => 'foouser', 89 | 'gid' => 'foouser', 90 | 'home' => '/home/foouser', 91 | 'managehome' => true, 92 | 'groups' => ['sys'], 93 | }) 94 | .that_requires('Group[foouser]') 95 | } 96 | 97 | it { should contain_group('foouser').with({ 98 | 'ensure' => 'present', 99 | 'name' => 'foouser', 100 | 'system' => 'false', 101 | }) } 102 | 103 | it { should contain_user('foouser').that_requires('Group[foouser]') } 104 | end # describe "default parameters" 105 | 106 | describe "realname specified" do 107 | let(:params) {{ 108 | 'username' => 'foouser', 109 | 'realname' => 'Foo User', 110 | }} 111 | 112 | it { should compile.with_all_deps } 113 | 114 | it { should contain_user('foouser').with({ 115 | 'name' => 'foouser', 116 | 'ensure' => 'present', 117 | 'comment' => 'Foo User', 118 | 'gid' => 'foouser', 119 | 'home' => '/home/foouser', 120 | 'managehome' => true, 121 | 'groups' => ['sys'], 122 | }) } 123 | 124 | it { should contain_group('foouser').with({ 125 | 'ensure' => 'present', 126 | 'name' => 'foouser', 127 | 'system' => 'false', 128 | }) } 129 | 130 | it { should contain_user('foouser').that_requires('Group[foouser]') } 131 | end # describe "default parameters" 132 | 133 | describe "shell specified" do 134 | let(:params) {{ 135 | 'username' => 'foouser', 136 | :shell => '/bin/zsh', 137 | }} 138 | 139 | it { should compile.with_all_deps } 140 | 141 | it { should contain_user('foouser').with({ 142 | 'shell' => '/bin/zsh', 143 | }) } 144 | end # describe "shell specified" 145 | 146 | describe "homedir specified" do 147 | let(:params) {{ 148 | 'username' => 'foouser', 149 | :user_home => '/home/notfoo', 150 | }} 151 | 152 | it { should compile.with_all_deps } 153 | 154 | it { should contain_user('foouser').with({ 155 | 'home' => '/home/notfoo', 156 | }) } 157 | end # describe "homedir specified" 158 | 159 | describe "groups specified" do 160 | let(:params) {{ 161 | 'username' => 'foouser', 162 | 'user_groups' => ['one', 'two', 'three'], 163 | }} 164 | 165 | it { should compile.with_all_deps } 166 | 167 | it { should contain_user('foouser').with({ 168 | :groups => ['one', 'two', 'three'], 169 | }) } 170 | 171 | it do 172 | should contain_user('foouser').that_requires('Group[foouser]') 173 | end 174 | 175 | end # describe "groups specified" 176 | 177 | end 178 | 179 | end 180 | -------------------------------------------------------------------------------- /spec/classes/kde_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'archlinux_workstation::kde' do 4 | let(:facts) { spec_facts } 5 | 6 | context 'parent class' do 7 | context 'without archlinux_workstation defined' do 8 | describe "raises error" do 9 | it { expect { should contain_class('archlinux_workstation::kde') }.to raise_error(Puppet::Error, /You must include the base/) } 10 | end 11 | end 12 | 13 | context 'with archlinux_workstation defined' do 14 | describe 'compiles correctly' do 15 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 16 | 17 | it { should compile.with_all_deps } 18 | 19 | it { should contain_class('archlinux_workstation') } 20 | it { should contain_class('archlinux_workstation::kde') } 21 | end 22 | end 23 | end # end context 'parent class' 24 | 25 | context 'parameters' do 26 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 27 | describe "default" do 28 | let(:params) {{ }} 29 | 30 | it { should compile.with_all_deps } 31 | 32 | it { should contain_package('plasma-meta').with_ensure('present') } 33 | it { should contain_package('kde-applications-meta').with_ensure('present') } 34 | 35 | $phonon_packages = [ 36 | 'phonon-qt5', 37 | 'phonon-qt5-gstreamer', 38 | 'phonon-qt5-vlc', 39 | ] 40 | 41 | $phonon_packages.each do |pkgname| 42 | it { should contain_package(pkgname).with_ensure('present') } 43 | end 44 | end 45 | 46 | end 47 | 48 | end 49 | -------------------------------------------------------------------------------- /spec/classes/makepkg_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'archlinux_workstation::makepkg' do 4 | let(:facts) { spec_facts } 5 | 6 | context 'parent class' do 7 | context 'without archlinux_workstation defined' do 8 | describe "raises error" do 9 | it { expect { should contain_class('archlinux_workstation::makepkg') }.to raise_error(Puppet::Error, /You must include the base/) } 10 | end 11 | end 12 | 13 | context 'with archlinux_workstation defined' do 14 | describe 'compiles correctly' do 15 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 16 | 17 | it { should compile.with_all_deps } 18 | 19 | it { should contain_class('archlinux_workstation') } 20 | it { should contain_class('archlinux_workstation::makepkg') } 21 | end 22 | end 23 | end # end context 'parent class' 24 | 25 | context 'parameters' do 26 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 27 | describe "default" do 28 | let(:params) {{ }} 29 | 30 | it { should compile.with_all_deps } 31 | 32 | it { should contain_file('/etc/makepkg.conf') 33 | .with_ensure('present') 34 | .with_owner('root') 35 | .with_group('root') 36 | .with_mode('0644') 37 | .with_content(/MAKEFLAGS="-j8"/) 38 | .without_content(/^PACKAGER/) 39 | } 40 | 41 | it { should contain_file('/tmp/sources') 42 | .with_ensure('directory') 43 | .with_owner('myuser') 44 | .with_mode('0775') 45 | } 46 | 47 | it { should contain_file('/tmp/makepkg') 48 | .with_ensure('directory') 49 | .with_owner('myuser') 50 | .with_mode('0775') 51 | } 52 | 53 | it { should contain_file('/tmp/makepkglogs') 54 | .with_ensure('directory') 55 | .with_owner('myuser') 56 | .with_mode('0775') 57 | } 58 | 59 | it { should contain_file('/etc/tmpfiles.d/makepkg_puppet.conf') 60 | .with_ensure('present') 61 | .with_owner('root') 62 | .with_group('root') 63 | .with_mode('0644') 64 | .with_content("# managed by archlinux_workstation::makepkg puppet class\nD /tmp/sources 0775 myuser wheel\nD /tmp/makepkg 0775 myuser wheel\nD /tmp/makepkglogs 0775 myuser wheel") 65 | } 66 | end 67 | 68 | describe "make_flags explicitly defined" do 69 | let(:params) {{ 70 | 'make_flags' => '-j1', 71 | }} 72 | 73 | it { should compile.with_all_deps } 74 | 75 | it do 76 | should contain_file('/etc/makepkg.conf') \ 77 | .with_content(/MAKEFLAGS="-j1"/) 78 | end 79 | end 80 | 81 | context 'archlinux_workstation::makepkg_packager set' do 82 | let(:pre_condition) { 83 | "class {'archlinux_workstation': username => 'myuser', makepkg_packager => 'Foo Bar ' }" 84 | } 85 | 86 | describe "make_flags explicitly defined" do 87 | let(:params) {{ }} 88 | 89 | it { should compile.with_all_deps } 90 | 91 | it do 92 | should contain_file('/etc/makepkg.conf') \ 93 | .with_content(/PACKAGER='Foo Bar '/) 94 | end 95 | end 96 | end 97 | end 98 | end 99 | -------------------------------------------------------------------------------- /spec/classes/networkmanager_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'archlinux_workstation::networkmanager' do 4 | let(:facts) { spec_facts } 5 | 6 | context 'parent class' do 7 | context 'without archlinux_workstation defined' do 8 | describe "raises error" do 9 | it { expect { should contain_class('archlinux_workstation::networkmanager') }.to raise_error(Puppet::Error, /You must include the base/) } 10 | end 11 | end 12 | 13 | context 'with archlinux_workstation defined' do 14 | describe 'compiles correctly' do 15 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 16 | 17 | it { should compile.with_all_deps } 18 | 19 | it { should contain_class('archlinux_workstation') } 20 | it { should contain_class('archlinux_workstation::networkmanager') } 21 | end 22 | end 23 | end # end context 'parent class' 24 | 25 | context 'parameters' do 26 | describe "default" do 27 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 28 | let(:params) {{ }} 29 | 30 | it { should compile.with_all_deps } 31 | 32 | it { should contain_package('networkmanager') } 33 | it { should_not contain_package('plasma-nm') } 34 | it { should contain_service('NetworkManager') 35 | .with({ 36 | 'enable' => true, 37 | 'ensure' => 'running', 38 | }) 39 | .that_requires('Package[networkmanager]') 40 | } 41 | 42 | it { should contain_service('dhcpcd@eth0') 43 | .with({ 44 | 'enable' => false, 45 | 'ensure' => 'stopped', 46 | }) 47 | .that_requires('Service[NetworkManager]') 48 | } 49 | 50 | it { should contain_service('dhcpcd@eth1') 51 | .with({ 52 | 'enable' => false, 53 | 'ensure' => 'stopped', 54 | }) 55 | .that_requires('Service[NetworkManager]') 56 | } 57 | 58 | it { should contain_service('dhcpcd@lo') 59 | .with({ 60 | 'enable' => false, 61 | 'ensure' => 'stopped', 62 | }) 63 | .that_requires('Service[NetworkManager]') 64 | } 65 | end 66 | 67 | describe "gui kde" do 68 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' } -> class {'archlinux_workstation::kde': }" } 69 | let(:params) {{ }} 70 | 71 | it { should compile.with_all_deps } 72 | 73 | it { should contain_package('networkmanager') } 74 | it { should contain_package('plasma-nm') 75 | .that_requires('Package[networkmanager]') } 76 | it { should contain_service('NetworkManager') 77 | .with({ 78 | 'enable' => true, 79 | 'ensure' => 'running', 80 | }) 81 | .that_requires('Package[networkmanager]') 82 | } 83 | 84 | it { should contain_service('dhcpcd@eth0') 85 | .with({ 86 | 'enable' => false, 87 | 'ensure' => 'stopped', 88 | }) 89 | .that_requires('Service[NetworkManager]') 90 | } 91 | 92 | it { should contain_service('dhcpcd@eth1') 93 | .with({ 94 | 'enable' => false, 95 | 'ensure' => 'stopped', 96 | }) 97 | .that_requires('Service[NetworkManager]') 98 | } 99 | 100 | it { should contain_service('dhcpcd@lo') 101 | .with({ 102 | 'enable' => false, 103 | 'ensure' => 'stopped', 104 | }) 105 | .that_requires('Service[NetworkManager]') 106 | } 107 | end 108 | 109 | end 110 | 111 | end 112 | -------------------------------------------------------------------------------- /spec/classes/repos/jantman_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'archlinux_workstation::repos::jantman' do 4 | let(:facts) { spec_facts } 5 | 6 | context 'parent class' do 7 | context 'without archlinux_workstation defined' do 8 | describe "raises error" do 9 | it { expect { should contain_class('archlinux_workstation::repos::jantman') }.to raise_error(Puppet::Error, /You must include the base/) } 10 | end 11 | end 12 | 13 | context 'with archlinux_workstation defined' do 14 | describe 'compiles correctly' do 15 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 16 | 17 | it { should compile.with_all_deps } 18 | 19 | it { should contain_class('archlinux_workstation') } 20 | it { should contain_class('archlinux_workstation::repos::jantman') } 21 | end 22 | end 23 | end # end context 'parent class' 24 | 25 | describe "class" do 26 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 27 | let(:params) {{ }} 28 | 29 | it { should compile.with_all_deps } 30 | it { should contain_archlinux_workstation__pacman_repo('jantman').with({ 31 | :server => 'http://archrepo.jasonantman.com/current', 32 | }) 33 | } 34 | 35 | it { should contain_ini_setting('archlinux_workstation-pacman_repo-jantman-server') } 36 | it { should contain_ini_setting('archlinux_workstation-pacman_repo-jantman-siglevel') } 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /spec/classes/repos/multilib_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'archlinux_workstation::repos::multilib' do 4 | let(:facts) { spec_facts } 5 | 6 | context 'parent class' do 7 | context 'without archlinux_workstation defined' do 8 | describe "raises error" do 9 | it { expect { should contain_class('archlinux_workstation::repos::multilib') }.to raise_error(Puppet::Error, /You must include the base/) } 10 | end 11 | end 12 | 13 | context 'with archlinux_workstation defined' do 14 | describe 'compiles correctly' do 15 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 16 | 17 | it { should compile.with_all_deps } 18 | 19 | it { should contain_class('archlinux_workstation') } 20 | it { should contain_class('archlinux_workstation::repos::multilib') } 21 | end 22 | end 23 | end # end context 'parent class' 24 | 25 | describe "class" do 26 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 27 | let(:params) {{ }} 28 | 29 | it { should compile.with_all_deps } 30 | it { should contain_archlinux_workstation__pacman_repo('multilib').with({ 31 | :include_file => '/etc/pacman.d/mirrorlist', 32 | }) 33 | } 34 | 35 | it { should contain_ini_setting('archlinux_workstation-pacman_repo-multilib-include') } 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /spec/classes/sddm_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'archlinux_workstation::sddm' do 4 | let(:facts) { spec_facts } 5 | 6 | context 'parent class' do 7 | context 'without archlinux_workstation defined' do 8 | describe "raises error" do 9 | it { expect { should contain_class('archlinux_workstation::sddm') }.to raise_error(Puppet::Error, /You must include the base/) } 10 | end 11 | end 12 | 13 | context 'with archlinux_workstation defined' do 14 | describe 'compiles correctly' do 15 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 16 | 17 | it { should compile.with_all_deps } 18 | 19 | it { should contain_class('archlinux_workstation') } 20 | it { should contain_class('archlinux_workstation::sddm') } 21 | end 22 | end 23 | end # end context 'parent class' 24 | context 'parameters' do 25 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 26 | describe "default" do 27 | let(:params) {{ }} 28 | 29 | it { should compile.with_all_deps } 30 | 31 | it { should contain_package('sddm') } 32 | 33 | it { should contain_service('sddm').with({ 34 | 'ensure' => 'running', 35 | 'enable' => true, 36 | }) } 37 | 38 | end 39 | describe "service_ensure stopped" do 40 | let(:params) {{ 'service_ensure' => 'stopped' }} 41 | 42 | it { should compile.with_all_deps } 43 | it { should contain_package('sddm') } 44 | it { should contain_service('sddm').with({ 45 | 'ensure' => 'stopped', 46 | 'enable' => true, 47 | }) } 48 | 49 | end 50 | end 51 | 52 | end 53 | -------------------------------------------------------------------------------- /spec/classes/ssh_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'archlinux_workstation::ssh' do 4 | let(:facts) { spec_facts } 5 | 6 | context 'parent class' do 7 | context 'without archlinux_workstation defined' do 8 | describe "raises error" do 9 | it { expect { should contain_class('archlinux_workstation::ssh') }.to raise_error(Puppet::Error, /You must include the base/) } 10 | end 11 | end 12 | 13 | context 'with archlinux_workstation defined' do 14 | describe 'compiles correctly' do 15 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 16 | 17 | it { should compile.with_all_deps } 18 | 19 | it { should contain_class('archlinux_workstation') } 20 | it { should contain_class('archlinux_workstation::ssh') } 21 | end 22 | end 23 | end # end context 'parent class' 24 | 25 | # add class-specific specs here 26 | context 'not on virtualbox' do 27 | describe 'without parameters' do 28 | let(:params) {{ }} 29 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 30 | 31 | it { should contain_class('ssh::server').with({ 32 | :storeconfigs_enabled => false, 33 | :options => { 34 | 'AcceptEnv' => ['LANG', 'LC_*', 'DISPLAY'], 35 | 'AllowUsers' => ['myuser'], 36 | 'AuthorizedKeysFile' => '.ssh/authorized_keys', 37 | 'GSSAPIAuthentication' => 'no', 38 | 'KerberosAuthentication' => 'no', 39 | 'PasswordAuthentication' => 'no', 40 | 'PermitRootLogin' => 'no', 41 | 'Port' => [22], 42 | 'PubkeyAuthentication' => 'yes', 43 | 'SyslogFacility' => 'AUTH', 44 | 'X11Forwarding' => 'yes', 45 | } 46 | }) 47 | } 48 | end 49 | 50 | describe 'with extra_options specified' do 51 | let(:params) {{ 52 | :extra_options => {'foo' => 'bar'} 53 | }} 54 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 55 | 56 | it { should contain_class('ssh::server').with({ 57 | :storeconfigs_enabled => false, 58 | :options => { 59 | 'AcceptEnv' => ['LANG', 'LC_*', 'DISPLAY'], 60 | 'AllowUsers' => ['myuser'], 61 | 'AuthorizedKeysFile' => '.ssh/authorized_keys', 62 | 'GSSAPIAuthentication' => 'no', 63 | 'KerberosAuthentication' => 'no', 64 | 'PasswordAuthentication' => 'no', 65 | 'PermitRootLogin' => 'no', 66 | 'Port' => [22], 67 | 'PubkeyAuthentication' => 'yes', 68 | 'SyslogFacility' => 'AUTH', 69 | 'X11Forwarding' => 'yes', 70 | 'foo' => 'bar', 71 | } 72 | }) 73 | } 74 | end 75 | 76 | describe 'with specified allow_users' do 77 | let(:params) {{ :allow_users => ['foo', 'bar'] }} 78 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 79 | 80 | it { should contain_class('ssh::server').with({ 81 | :storeconfigs_enabled => false, 82 | :options => { 83 | 'AcceptEnv' => ['LANG', 'LC_*', 'DISPLAY'], 84 | 'AllowUsers' => ['foo', 'bar'], 85 | 'AuthorizedKeysFile' => '.ssh/authorized_keys', 86 | 'GSSAPIAuthentication' => 'no', 87 | 'KerberosAuthentication' => 'no', 88 | 'PasswordAuthentication' => 'no', 89 | 'PermitRootLogin' => 'no', 90 | 'Port' => [22], 91 | 'PubkeyAuthentication' => 'yes', 92 | 'SyslogFacility' => 'AUTH', 93 | 'X11Forwarding' => 'yes', 94 | } 95 | }) 96 | } 97 | end 98 | describe 'with permit_root true' do 99 | let(:params) {{ :permit_root => true }} 100 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 101 | 102 | it { should contain_class('ssh::server').with({ 103 | :storeconfigs_enabled => false, 104 | :options => { 105 | 'AcceptEnv' => ['LANG', 'LC_*', 'DISPLAY'], 106 | 'AllowUsers' => ['myuser', 'root'], 107 | 'AuthorizedKeysFile' => '.ssh/authorized_keys', 108 | 'GSSAPIAuthentication' => 'no', 109 | 'KerberosAuthentication' => 'no', 110 | 'PasswordAuthentication' => 'no', 111 | 'PermitRootLogin' => 'yes', 112 | 'Port' => [22], 113 | 'PubkeyAuthentication' => 'yes', 114 | 'SyslogFacility' => 'AUTH', 115 | 'X11Forwarding' => 'yes', 116 | } 117 | }) 118 | } 119 | end 120 | 121 | describe 'with permit_root true and allow_users' do 122 | let(:params) {{ :permit_root => true, :allow_users => ['foo', 'bar'] }} 123 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 124 | 125 | it { should contain_class('ssh::server').with({ 126 | :storeconfigs_enabled => false, 127 | :options => { 128 | 'AcceptEnv' => ['LANG', 'LC_*', 'DISPLAY'], 129 | 'AllowUsers' => ['foo', 'bar', 'root'], 130 | 'AuthorizedKeysFile' => '.ssh/authorized_keys', 131 | 'GSSAPIAuthentication' => 'no', 132 | 'KerberosAuthentication' => 'no', 133 | 'PasswordAuthentication' => 'no', 134 | 'PermitRootLogin' => 'yes', 135 | 'Port' => [22], 136 | 'PubkeyAuthentication' => 'yes', 137 | 'SyslogFacility' => 'AUTH', 138 | 'X11Forwarding' => 'yes', 139 | } 140 | }) 141 | } 142 | end 143 | end 144 | 145 | context 'on virtualbox' do 146 | let(:facts) { spec_facts(:virtual => 'virtualbox') } 147 | 148 | describe 'without parameters' do 149 | let(:params) {{ }} 150 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 151 | 152 | it { should contain_class('ssh::server').with({ 153 | :storeconfigs_enabled => false, 154 | :options => { 155 | 'AcceptEnv' => ['LANG', 'LC_*', 'DISPLAY'], 156 | 'AllowUsers' => ['myuser', 'vagrant'], 157 | 'AuthorizedKeysFile' => '.ssh/authorized_keys', 158 | 'GSSAPIAuthentication' => 'no', 159 | 'KerberosAuthentication' => 'no', 160 | 'PasswordAuthentication' => 'no', 161 | 'PermitRootLogin' => 'no', 162 | 'Port' => [22], 163 | 'PubkeyAuthentication' => 'yes', 164 | 'SyslogFacility' => 'AUTH', 165 | 'X11Forwarding' => 'yes', 166 | } 167 | }) 168 | } 169 | 170 | it { should contain_notify('adding vagrant to list of SSH allowed users, per $::virtual fact') } 171 | end 172 | 173 | describe 'with specified allow_users' do 174 | let(:params) {{ :allow_users => ['foo', 'bar'] }} 175 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 176 | 177 | it { should contain_class('ssh::server').with({ 178 | :storeconfigs_enabled => false, 179 | :options => { 180 | 'AcceptEnv' => ['LANG', 'LC_*', 'DISPLAY'], 181 | 'AllowUsers' => ['foo', 'bar', 'vagrant'], 182 | 'AuthorizedKeysFile' => '.ssh/authorized_keys', 183 | 'GSSAPIAuthentication' => 'no', 184 | 'KerberosAuthentication' => 'no', 185 | 'PasswordAuthentication' => 'no', 186 | 'PermitRootLogin' => 'no', 187 | 'Port' => [22], 188 | 'PubkeyAuthentication' => 'yes', 189 | 'SyslogFacility' => 'AUTH', 190 | 'X11Forwarding' => 'yes', 191 | } 192 | }) 193 | } 194 | end 195 | describe 'with permit_root true' do 196 | let(:params) {{ :permit_root => true }} 197 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 198 | 199 | it { should contain_class('ssh::server').with({ 200 | :storeconfigs_enabled => false, 201 | :options => { 202 | 'AcceptEnv' => ['LANG', 'LC_*', 'DISPLAY'], 203 | 'AllowUsers' => ['myuser', 'root', 'vagrant'], 204 | 'AuthorizedKeysFile' => '.ssh/authorized_keys', 205 | 'GSSAPIAuthentication' => 'no', 206 | 'KerberosAuthentication' => 'no', 207 | 'PasswordAuthentication' => 'no', 208 | 'PermitRootLogin' => 'yes', 209 | 'Port' => [22], 210 | 'PubkeyAuthentication' => 'yes', 211 | 'SyslogFacility' => 'AUTH', 212 | 'X11Forwarding' => 'yes', 213 | } 214 | }) 215 | } 216 | end 217 | end 218 | 219 | end 220 | -------------------------------------------------------------------------------- /spec/classes/sudo_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'archlinux_workstation::sudo' do 4 | let(:facts) { spec_facts } 5 | 6 | context 'parent class' do 7 | context 'without archlinux_workstation defined' do 8 | describe "raises error" do 9 | it { expect { should contain_class('archlinux_workstation::sudo') }.to raise_error(Puppet::Error, /You must include the base/) } 10 | end 11 | end 12 | 13 | context 'with archlinux_workstation defined' do 14 | describe 'compiles correctly' do 15 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 16 | 17 | it { should compile.with_all_deps } 18 | 19 | it { should contain_class('archlinux_workstation') } 20 | it { should contain_class('archlinux_workstation::sudo') } 21 | end 22 | end 23 | end # end context 'parent class' 24 | 25 | # add class-specific specs here 26 | context 'non-virtual' do 27 | describe 'includes all resources' do 28 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 29 | 30 | it { should compile.with_all_deps } 31 | 32 | it { should contain_class('sudo') } 33 | it { should contain_sudo__conf('defaults-env_keep') 34 | .with_priority(0) 35 | .with_content('Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET QTDIR KDEDIR XDG_SESSION_COOKIE"') 36 | } 37 | it { should contain_sudo__conf('myuser-all') 38 | .with_priority(10) 39 | .with_content('myuser ALL=(ALL) ALL') 40 | } 41 | it { should_not contain_sudo__conf('vagrant-all') } 42 | end 43 | end 44 | context 'virtualbox' do 45 | let(:facts) { spec_facts(:virtual => 'virtualbox') } 46 | describe 'includes all resources' do 47 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 48 | 49 | it { should compile.with_all_deps } 50 | 51 | it { should contain_class('sudo') } 52 | it { should contain_sudo__conf('defaults-env_keep') 53 | .with_priority(0) 54 | .with_content('Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET QTDIR KDEDIR XDG_SESSION_COOKIE"') 55 | } 56 | it { should contain_sudo__conf('myuser-all') 57 | .with_priority(10) 58 | .with_content('myuser ALL=(ALL) ALL') 59 | } 60 | it { should contain_sudo__conf('vagrant-all') 61 | .with_priority(11) 62 | .with_content('vagrant ALL=(ALL) NOPASSWD: ALL') 63 | } 64 | 65 | it { should contain_notify('adding vagrant to sudoers users, per $::virtual fact') } 66 | end 67 | end 68 | 69 | end 70 | -------------------------------------------------------------------------------- /spec/classes/template.txt: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'archlinux_workstation::CLASSNAME' do 4 | let(:facts) { spec_facts } 5 | 6 | context 'parent class' do 7 | context 'without archlinux_workstation defined' do 8 | describe "raises error" do 9 | it { expect { should contain_class('archlinux_workstation::CLASSNAME') }.to raise_error(Puppet::Error, /You must include the base/) } 10 | end 11 | end 12 | 13 | context 'with archlinux_workstation defined' do 14 | describe 'compiles correctly' do 15 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 16 | 17 | it { should compile.with_all_deps } 18 | 19 | it { should contain_class('archlinux_workstation') } 20 | it { should contain_class('archlinux_workstation::CLASSNAME') } 21 | end 22 | end 23 | end # end context 'parent class' 24 | 25 | # add class-specific specs here 26 | context 'foo' do 27 | 28 | end 29 | 30 | end 31 | -------------------------------------------------------------------------------- /spec/classes/userapps/virtualbox_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'archlinux_workstation::userapps::virtualbox' do 4 | let(:facts) { spec_facts } 5 | 6 | context 'parent class' do 7 | context 'without archlinux_workstation defined' do 8 | describe "raises error" do 9 | it { expect { should contain_class('archlinux_workstation::userapps::virtualbox') }.to raise_error(Puppet::Error, /You must include the base/) } 10 | end 11 | end 12 | 13 | context 'with archlinux_workstation defined' do 14 | describe 'compiles correctly' do 15 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 16 | 17 | it { should compile.with_all_deps } 18 | 19 | it { should contain_class('archlinux_workstation') } 20 | it { should contain_class('archlinux_workstation::userapps::virtualbox') } 21 | end 22 | end 23 | end # end context 'parent class' 24 | 25 | context 'parameters' do 26 | describe "default" do 27 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 28 | let(:params) {{ }} 29 | 30 | it { should compile.with_all_deps } 31 | 32 | packages = ['virtualbox', 33 | 'virtualbox-host-dkms', 34 | 'virtualbox-guest-iso', 35 | 'virtualbox-ext-oracle', 36 | ] 37 | 38 | packages.each do |package| 39 | describe "package #{package}" do 40 | it { should contain_package(package).with_ensure('present') } 41 | end 42 | end 43 | 44 | it { should contain_file('/etc/modules-load.d/virtualbox.conf') 45 | .with_ensure('present') 46 | .with_owner('root') 47 | .with_group('root') 48 | .with_mode('0644') 49 | .with_content("# managed by puppet module archlinux_workstation\nvboxdrv\nvboxnetadp\nvboxnetflt\nvboxpci") 50 | } 51 | 52 | end 53 | 54 | describe 'virtual user has group added' do 55 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 56 | let(:params) {{ }} 57 | 58 | it { should compile.with_all_deps } 59 | it { should contain_user('myuser') 60 | .with_groups(['sys', 'vboxusers']) 61 | .that_requires(['Group[myuser]', 'Package[virtualbox]']) 62 | } 63 | end 64 | end 65 | 66 | end 67 | -------------------------------------------------------------------------------- /spec/classes/xorg_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'archlinux_workstation::xorg' do 4 | let(:facts) { spec_facts } 5 | 6 | context 'parent class' do 7 | context 'without archlinux_workstation defined' do 8 | describe "raises error" do 9 | it { expect { should contain_class('archlinux_workstation::xorg') }.to raise_error(Puppet::Error, /You must include the base/) } 10 | end 11 | end 12 | 13 | context 'with archlinux_workstation defined' do 14 | describe 'compiles correctly' do 15 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 16 | 17 | it { should compile.with_all_deps } 18 | 19 | it { should contain_class('archlinux_workstation') } 20 | it { should contain_class('archlinux_workstation::xorg') } 21 | end 22 | end 23 | end # end context 'parent class' 24 | 25 | context 'ensure present packages' do 26 | let(:pre_condition) { "class {'archlinux_workstation': username => 'myuser' }" } 27 | 28 | it { should compile.with_all_deps } 29 | 30 | packages = ['xorg-server', 31 | 'xorg-apps', 32 | 'xorg-xinit', 33 | 'mesa', 34 | 'xf86-video-vesa', 35 | 'xterm' 36 | ] 37 | 38 | packages.each do |package| 39 | describe "package #{package}" do 40 | it { should contain_package(package).with_ensure('present') } 41 | end 42 | end 43 | 44 | end 45 | 46 | end 47 | -------------------------------------------------------------------------------- /spec/defines/pacman_repo_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'archlinux_workstation::pacman_repo', :type => :define do 4 | 5 | let :title do 6 | 'myrepo' 7 | end 8 | 9 | context 'defined with' do 10 | let(:facts) { spec_facts } 11 | 12 | describe "default parameters" do 13 | let(:params) {{ 14 | }} 15 | 16 | it { expect { should compile.with_all_deps }.to raise_error(RSpec::Expectations::ExpectationNotMetError, /Either server or include_file must be specified on define archlinux_workstation::pacman_repo\[myrepo\]/) } 17 | end 18 | 19 | describe "standard parameters" do 20 | let(:params) {{ 21 | :server => 'http://myserver', 22 | }} 23 | 24 | it { should compile.with_all_deps } 25 | 26 | it { should contain_exec('pacman_repo-Sy').with({ 27 | 'command' => '/usr/bin/pacman -Sy', 28 | 'refreshonly' => 'true', 29 | }) } 30 | 31 | it { should contain_ini_setting('archlinux_workstation-pacman_repo-myrepo-siglevel').with({ 32 | 'ensure' => 'present', 33 | 'path' => '/etc/pacman.conf', 34 | 'section' => 'myrepo', 35 | 'setting' => 'SigLevel', 36 | 'value' => 'Optional TrustedOnly', 37 | 'notify' => 'Exec[pacman_repo-Sy]', 38 | }) 39 | } 40 | 41 | it { should contain_ini_setting('archlinux_workstation-pacman_repo-myrepo-server').with({ 42 | 'ensure' => 'present', 43 | 'path' => '/etc/pacman.conf', 44 | 'section' => 'myrepo', 45 | 'setting' => 'Server', 46 | 'value' => 'http://myserver', 47 | 'notify' => 'Exec[pacman_repo-Sy]', 48 | }) 49 | } 50 | end 51 | 52 | describe "specified repo_name" do 53 | let(:params) {{ 54 | :server => 'http://myserver', 55 | :repo_name => 'arepo', 56 | }} 57 | 58 | it { should compile.with_all_deps } 59 | 60 | it { should contain_exec('pacman_repo-Sy').with({ 61 | 'command' => '/usr/bin/pacman -Sy', 62 | 'refreshonly' => 'true', 63 | }) } 64 | 65 | it { should contain_ini_setting('archlinux_workstation-pacman_repo-myrepo-siglevel').with({ 66 | 'ensure' => 'present', 67 | 'path' => '/etc/pacman.conf', 68 | 'section' => 'arepo', 69 | 'setting' => 'SigLevel', 70 | 'value' => 'Optional TrustedOnly', 71 | 'notify' => 'Exec[pacman_repo-Sy]', 72 | }) 73 | } 74 | 75 | it { should contain_ini_setting('archlinux_workstation-pacman_repo-myrepo-server').with({ 76 | 'ensure' => 'present', 77 | 'path' => '/etc/pacman.conf', 78 | 'section' => 'arepo', 79 | 'setting' => 'Server', 80 | 'value' => 'http://myserver', 81 | 'notify' => 'Exec[pacman_repo-Sy]', 82 | }) 83 | } 84 | end 85 | 86 | describe "specified siglevel" do 87 | let(:params) {{ 88 | :server => 'http://myserver', 89 | :siglevel => 'foo', 90 | }} 91 | 92 | it { should compile.with_all_deps } 93 | 94 | it { should contain_exec('pacman_repo-Sy').with({ 95 | 'command' => '/usr/bin/pacman -Sy', 96 | 'refreshonly' => 'true', 97 | }) } 98 | 99 | it { should contain_ini_setting('archlinux_workstation-pacman_repo-myrepo-siglevel').with({ 100 | 'ensure' => 'present', 101 | 'path' => '/etc/pacman.conf', 102 | 'section' => 'myrepo', 103 | 'setting' => 'SigLevel', 104 | 'value' => 'foo', 105 | 'notify' => 'Exec[pacman_repo-Sy]', 106 | }) 107 | } 108 | 109 | it { should contain_ini_setting('archlinux_workstation-pacman_repo-myrepo-server').with({ 110 | 'ensure' => 'present', 111 | 'path' => '/etc/pacman.conf', 112 | 'section' => 'myrepo', 113 | 'setting' => 'Server', 114 | 'value' => 'http://myserver', 115 | 'notify' => 'Exec[pacman_repo-Sy]', 116 | }) 117 | } 118 | end 119 | 120 | describe "include_file" do 121 | let(:params) {{ 122 | :include_file => '/foo/bar', 123 | }} 124 | 125 | it { should compile.with_all_deps } 126 | 127 | it { should contain_exec('pacman_repo-Sy').with({ 128 | 'command' => '/usr/bin/pacman -Sy', 129 | 'refreshonly' => 'true', 130 | }) } 131 | 132 | it { should contain_ini_setting('archlinux_workstation-pacman_repo-myrepo-include').with({ 133 | 'ensure' => 'present', 134 | 'path' => '/etc/pacman.conf', 135 | 'section' => 'myrepo', 136 | 'setting' => 'Include', 137 | 'value' => '/foo/bar', 138 | 'notify' => 'Exec[pacman_repo-Sy]', 139 | }) 140 | } 141 | end 142 | end 143 | end 144 | -------------------------------------------------------------------------------- /spec/defines/rvm_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'archlinux_workstation::userapps::rvm', :type => :define do 4 | 5 | let :title do 6 | 'foouser' 7 | end 8 | 9 | context 'defined with' do 10 | let(:facts) { spec_facts } 11 | 12 | describe "default parameters" do 13 | let(:params) {{ }} 14 | 15 | it { should compile.with_all_deps } 16 | 17 | it { should contain_exec('rvm-install-foouser').with({ 18 | 'command' => 'curl -sSL https://get.rvm.io | bash -s -- --ignore-dotfiles', 19 | 'creates' => '/home/foouser/.rvm/bin/rvm', 20 | 'user' => 'foouser', 21 | 'cwd' => '/home/foouser', 22 | 'path' => '/usr/bin:/bin', 23 | 'environment' => 'HOME=/home/foouser', 24 | 'require' => 'File[/etc/gemrc]', 25 | }) 26 | } 27 | 28 | it { should contain_file('/etc/gemrc').with_ensure('absent') } 29 | end # describe "default parameters" 30 | 31 | describe "homedir specified" do 32 | let(:params) {{ 33 | :userhome => '/not/usual/home', 34 | }} 35 | 36 | it { should compile.with_all_deps } 37 | 38 | it { should contain_exec('rvm-install-foouser').with({ 39 | 'command' => 'curl -sSL https://get.rvm.io | bash -s -- --ignore-dotfiles', 40 | 'creates' => '/not/usual/home/.rvm/bin/rvm', 41 | 'user' => 'foouser', 42 | 'cwd' => '/not/usual/home', 43 | 'path' => '/usr/bin:/bin', 44 | 'environment' => 'HOME=/not/usual/home', 45 | 'require' => 'File[/etc/gemrc]', 46 | }) } 47 | 48 | it { should contain_file('/etc/gemrc').with_ensure('absent') } 49 | end # describe "shell specified" 50 | 51 | end 52 | 53 | end 54 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # This file is generated by ModuleSync, do not edit. 2 | require 'puppetlabs_spec_helper/module_spec_helper' 3 | 4 | if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0 5 | RSpec.configure do |c| 6 | c.before :each do 7 | Puppet.settings[:strict] = :error 8 | end 9 | end 10 | end 11 | 12 | # put local configuration and setup into spec_helper_local 13 | begin 14 | require 'spec_helper_local' 15 | rescue LoadError => loaderror 16 | puts "Could not require spec_helper_local: #{loaderror.message}" 17 | end 18 | -------------------------------------------------------------------------------- /spec/spec_helper_acceptance.rb: -------------------------------------------------------------------------------- 1 | require 'beaker-rspec' 2 | require 'beaker/puppet_install_helper' 3 | require 'beaker/module_install_helper' 4 | 5 | RSpec.configure do |c| 6 | # Project root 7 | proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) 8 | 9 | # Readable test descriptions 10 | c.formatter = :documentation 11 | 12 | # Configure all nodes in nodeset 13 | c.before :suite do 14 | # pacman update 15 | hosts.each do |h| 16 | on h, 'pacman -Syu --noconfirm' unless ENV['BEAKER_provision'] == 'no' 17 | run_puppet_install_helper unless ENV['BEAKER_provision'] == 'no' 18 | install_module_dependencies_on(h) 19 | # on ArchLinux, install_module_on(hosts) installs in /etc/puppet/modules 20 | # instead of /etc/puppetlabs/code/modules 21 | copy_module_to(h, source: proj_root, module_name: 'archlinux_workstation', target_module_path: '/etc/puppetlabs/code/modules') 22 | end 23 | # helper for spec/acceptance/classes/userapps/rvm_spec.rb 24 | scp_to(hosts, File.join(proj_root, 'spec', 'test_rvm.sh'), '/tmp/test_rvm.sh') 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /spec/spec_helper_local.rb: -------------------------------------------------------------------------------- 1 | require 'puppet' 2 | 3 | # helper to allow easy definition of a base set of facts for all specs 4 | def spec_facts(additional = {}) 5 | facts = { 6 | :osfamily => 'Archlinux', 7 | :operatingsystem => 'Archlinux', 8 | :concat_basedir => '/tmp', 9 | :processorcount => 8, 10 | :puppetversion => Puppet::PUPPETVERSION, 11 | :virtual => 'physical', 12 | :interfaces => 'eth0,eth1,lo', 13 | # structured facts 14 | :os => { 'family' => 'Archlinux' }, 15 | :processors => { 'count' => 8 }, 16 | :networking => { 17 | 'interfaces' => { 18 | 'eth0' => { 19 | 'dhcp' => "192.168.0.1", 20 | 'ip' => "192.168.0.24", 21 | }, 22 | 'eth1' => { 23 | 'dhcp' => "192.168.0.1", 24 | 'ip' => "192.168.0.24", 25 | }, 26 | 'lo' => { 27 | 'ip' => "127.0.0.1", 28 | 'ip6' => "::1", 29 | }, 30 | }, 31 | } 32 | } 33 | facts.merge(additional) 34 | end 35 | -------------------------------------------------------------------------------- /spec/test_rvm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # jantman/archlinux_workstation - 3 | # per-user RVM spec helper for spec/acceptance/classes/userapps/rvm_spec.rb 4 | 5 | source ~/.rvm/bin/rvm 6 | rvm list 7 | -------------------------------------------------------------------------------- /templates/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jantman/puppet-archlinux-workstation/54702178bff3c1a8cbd6030b71459da89b239000/templates/.gitkeep -------------------------------------------------------------------------------- /templates/makepkg.conf.erb: -------------------------------------------------------------------------------- 1 | ############################################################## 2 | # WARNING - WARNING - WARNING 3 | # This file is managed by the archlinux_workstation 4 | # puppet module. Any local changes made here will be 5 | # overwritten on the next Puppet run. Please change the 6 | # file in the puppet module for persistent changes. 7 | ############################################################## 8 | 9 | # 10 | # /etc/makepkg.conf 11 | # 12 | 13 | ######################################################################### 14 | # SOURCE ACQUISITION 15 | ######################################################################### 16 | # 17 | #-- The download utilities that makepkg should use to acquire sources 18 | # Format: 'protocol::agent' 19 | DLAGENTS=('ftp::/usr/bin/curl -fC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u' 20 | 'http::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u' 21 | 'https::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u' 22 | 'rsync::/usr/bin/rsync --no-motd -z %u %o' 23 | 'scp::/usr/bin/scp -C %u %o') 24 | 25 | # Other common tools: 26 | # /usr/bin/snarf 27 | # /usr/bin/lftpget -c 28 | # /usr/bin/wget 29 | 30 | #-- The package required by makepkg to download VCS sources 31 | # Format: 'protocol::package' 32 | VCSCLIENTS=('bzr::bzr' 33 | 'git::git' 34 | 'hg::mercurial' 35 | 'svn::subversion') 36 | 37 | ######################################################################### 38 | # ARCHITECTURE, COMPILE FLAGS 39 | ######################################################################### 40 | # 41 | CARCH="x86_64" 42 | CHOST="x86_64-unknown-linux-gnu" 43 | 44 | #-- Compiler and Linker Flags 45 | # -march (or -mcpu) builds exclusively for an architecture 46 | # -mtune optimizes for an architecture, but builds for whole processor family 47 | CPPFLAGS="-D_FORTIFY_SOURCE=2" 48 | CFLAGS="-march=native -O2 -pipe -fstack-protector --param=ssp-buffer-size=4" 49 | CXXFLAGS="-march=native -O2 -pipe -fstack-protector --param=ssp-buffer-size=4" 50 | LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro" 51 | #-- Make Flags: change this for DistCC/SMP systems 52 | MAKEFLAGS="<%= @make_flags %>" 53 | #-- Debugging flags 54 | DEBUG_CFLAGS="-g -fvar-tracking-assignments" 55 | DEBUG_CXXFLAGS="-g -fvar-tracking-assignments" 56 | 57 | ######################################################################### 58 | # BUILD ENVIRONMENT 59 | ######################################################################### 60 | # 61 | # Defaults: BUILDENV=(fakeroot !distcc color !ccache check !sign) 62 | # A negated environment option will do the opposite of the comments below. 63 | # 64 | #-- fakeroot: Allow building packages as a non-root user 65 | #-- distcc: Use the Distributed C/C++/ObjC compiler 66 | #-- color: Colorize output messages 67 | #-- ccache: Use ccache to cache compilation 68 | #-- check: Run the check() function if present in the PKGBUILD 69 | #-- sign: Generate PGP signature file 70 | # 71 | BUILDENV=(fakeroot !distcc color !ccache check !sign) 72 | # 73 | #-- If using DistCC, your MAKEFLAGS will also need modification. In addition, 74 | #-- specify a space-delimited list of hosts running in the DistCC cluster. 75 | #DISTCC_HOSTS="" 76 | # 77 | #-- Specify a directory for package building. 78 | BUILDDIR=/tmp/makepkg 79 | 80 | ######################################################################### 81 | # GLOBAL PACKAGE OPTIONS 82 | # These are default values for the options=() settings 83 | ######################################################################### 84 | # 85 | # Default: OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !upx !debug) 86 | # A negated option will do the opposite of the comments below. 87 | # 88 | #-- strip: Strip symbols from binaries/libraries 89 | #-- docs: Save doc directories specified by DOC_DIRS 90 | #-- libtool: Leave libtool (.la) files in packages 91 | #-- staticlibs: Leave static library (.a) files in packages 92 | #-- emptydirs: Leave empty directories in packages 93 | #-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip 94 | #-- purge: Remove files specified by PURGE_TARGETS 95 | #-- upx: Compress binary executable files using UPX 96 | #-- debug: Add debugging flags as specified in DEBUG_* variables 97 | # 98 | OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !upx !debug) 99 | 100 | #-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512 101 | INTEGRITY_CHECK=(md5) 102 | #-- Options to be used when stripping binaries. See `man strip' for details. 103 | STRIP_BINARIES="--strip-all" 104 | #-- Options to be used when stripping shared libraries. See `man strip' for details. 105 | STRIP_SHARED="--strip-unneeded" 106 | #-- Options to be used when stripping static libraries. See `man strip' for details. 107 | STRIP_STATIC="--strip-debug" 108 | #-- Manual (man and info) directories to compress (if zipman is specified) 109 | MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info}) 110 | #-- Doc directories to remove (if !docs is specified) 111 | DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc}) 112 | #-- Files to be removed from all packages (if purge is specified) 113 | PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod) 114 | 115 | ######################################################################### 116 | # PACKAGE OUTPUT 117 | ######################################################################### 118 | # 119 | # Default: put built package and cached source in build directory 120 | # 121 | #-- Destination: specify a fixed directory where all packages will be placed 122 | #PKGDEST=/home/packages 123 | #-- Source cache: specify a fixed directory where source files will be cached 124 | SRCDEST=/tmp/sources 125 | #-- Source packages: specify a fixed directory where all src packages will be placed 126 | #SRCPKGDEST=/home/srcpackages 127 | #-- Log files: specify a fixed directory where all log files will be placed 128 | LOGDEST=/tmp/makepkglogs 129 | #-- Packager: name/email of the person or organization building packages 130 | #PACKAGER="John Doe " 131 | <% if @makepkg_packager -%> 132 | PACKAGER='<%= @makepkg_packager %>' 133 | <% end -%> 134 | #-- Specify a key to use for package signing 135 | #GPGKEY="" 136 | 137 | ######################################################################### 138 | # COMPRESSION DEFAULTS 139 | ######################################################################### 140 | # 141 | COMPRESSGZ=(gzip -c -f -n) 142 | COMPRESSBZ2=(bzip2 -c -f) 143 | COMPRESSXZ=(xz -c -z -) 144 | COMPRESSLRZ=(lrzip -q) 145 | COMPRESSLZO=(lzop -q) 146 | COMPRESSZ=(compress -c -f) 147 | 148 | ######################################################################### 149 | # EXTENSION DEFAULTS 150 | ######################################################################### 151 | # 152 | # WARNING: Do NOT modify these variables unless you know what you are 153 | # doing. 154 | # 155 | PKGEXT='.pkg.tar.xz' 156 | SRCEXT='.src.tar.gz' 157 | 158 | # vim: set ft=sh ts=2 sw=2 et: 159 | --------------------------------------------------------------------------------